WSL/SLF GitLab Repository

Commit a7e95642 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

More improvements to cmake

parent a45d092c
#SPDX-License-Identifier: GPL-3.0-or-later
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0)
PROJECT(inishell VERSION 2.0.7)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED True)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/src/main/config.h.in ${PROJECT_SOURCE_DIR}/src/main/config.h)
###########################################################
# Set language compatibility and qt tools
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
......@@ -19,77 +20,13 @@ ENDIF()
FIND_PACKAGE(Qt5 COMPONENTS Widgets Xml XmlPatterns REQUIRED)
SET(QT5_LIBRARIES Qt5::Widgets Qt5::Xml Qt5::XmlPatterns)
SET(TARGET ${CMAKE_PROJECT_NAME})
SET(EXTRA_LIBS_SRC
./lib/tinyexpr.c
)
SET(PANELS_SRC
./src/panels/Number.cc
./src/panels/Atomic.cc
./src/panels/Copytext.cc
./src/panels/dynamic_panels.cc
./src/panels/panels.cc
./src/panels/Group.cc
./src/panels/FilePath.cc
./src/panels/Selector.cc
./src/panels/Helptext.cc
./src/panels/GridPanel.cc
./src/panels/ImageView.cc
./src/panels/Checklist.cc
./src/panels/Replicator.cc
./src/panels/Checkbox.cc
./src/panels/Spacer.cc
./src/panels/HorizontalPanel.cc
./src/panels/Datepicker.cc
./src/panels/Textfield.cc
./src/panels/Choice.cc
./src/panels/Label.cc
./src/panels/Dropdown.cc
)
SET(GUI_SRC
./src/gui/WorkflowPanel.cc
./src/gui/PreviewWindow.cc
./src/gui/AboutWindow.cc
./src/gui/TerminalView.cc
./src/gui/IniFolderView.cc
./src/gui/ApplicationsView.cc
./src/gui/SectionButton.cc
./src/gui/RememberDialog.cc
./src/gui/PathView.cc
./src/gui/HelpWindow.cc
./src/gui/Logger.cc
./src/gui/SettingsWindow.cc
./src/gui/MainPanel.cc
./src/gui/PreviewEdit.cc
./src/gui/MainWindow.cc
./src/gui/SectionTab.cc
)
SET(MAIN_SRC
./src/main/XMLReader.cc
./src/main/INIParser.cc
./src/main/dimensions.cc
./src/main/settings.cc
./src/main/common.cc
./src/main/Error.cc
./src/main/expressions.cc
./src/main/inishell.cc
./src/main/SyntaxHighlighter.cc
./src/main/os.cc
./src/main/main.cc
./src/main/colors.cc
)
SET(RESOURCES
resources/inishell.qrc
)
SET(EXTRA_LIBS_SRC ./lib/tinyexpr.c)
SET(RESOURCES resources/inishell.qrc)
INCLUDE("${PROJECT_SOURCE_DIR}/src/CMakeLists.txt")
SET(TARGET ${CMAKE_PROJECT_NAME})
ADD_EXECUTABLE(${TARGET} ${EXTRA_LIBS_SRC} ${SOURCES} ${RESOURCES})
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/")
SET(SOURCES ${EXTRA_LIBS_SRC} ${PANELS_SRC} ${GUI_SRC} ${MAIN_SRC} ${RESOURCES})
ADD_EXECUTABLE(${TARGET} ${SOURCES})
TARGET_LINK_LIBRARIES(${TARGET} ${QT5_LIBRARIES})
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin"
......@@ -97,6 +34,8 @@ SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
OUTPUT_NAME ${TARGET})
INSTALL(TARGETS ${TARGET} RUNTIME DESTINATION bin COMPONENT exe)
###########################################################
# Custom targets
ADD_CUSTOM_TARGET(distclean make clean
COMMAND cmake -E remove CMakeCache.txt CPackSourceConfig.cmake CPackConfig.cmake CTestTestfile.cmake DartConfiguration.tcl cmake_install.cmake cmake_uninstall.cmake install_manifest.txt Makefile
COMMAND cmake -E remove bin/inishell bin/inishell.*
......@@ -105,3 +44,12 @@ ADD_CUSTOM_TARGET(distclean make clean
COMMAND cmake -E remove_directory CMakeFiles
COMMAND cmake -E remove_directory build/tmp/obj tmp/obj inishell_autogen
)
#for the uninstall target
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/tools/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
#SPDX-License-Identifier: GPL-3.0-or-later
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/")
SET(PANELS_SRC
./src/panels/Number.cc
./src/panels/Atomic.cc
./src/panels/Copytext.cc
./src/panels/dynamic_panels.cc
./src/panels/panels.cc
./src/panels/Group.cc
./src/panels/FilePath.cc
./src/panels/Selector.cc
./src/panels/Helptext.cc
./src/panels/GridPanel.cc
./src/panels/ImageView.cc
./src/panels/Checklist.cc
./src/panels/Replicator.cc
./src/panels/Checkbox.cc
./src/panels/Spacer.cc
./src/panels/HorizontalPanel.cc
./src/panels/Datepicker.cc
./src/panels/Textfield.cc
./src/panels/Choice.cc
./src/panels/Label.cc
./src/panels/Dropdown.cc
)
SET(GUI_SRC
./src/gui/WorkflowPanel.cc
./src/gui/PreviewWindow.cc
./src/gui/AboutWindow.cc
./src/gui/TerminalView.cc
./src/gui/IniFolderView.cc
./src/gui/ApplicationsView.cc
./src/gui/SectionButton.cc
./src/gui/RememberDialog.cc
./src/gui/PathView.cc
./src/gui/HelpWindow.cc
./src/gui/Logger.cc
./src/gui/SettingsWindow.cc
./src/gui/MainPanel.cc
./src/gui/PreviewEdit.cc
./src/gui/MainWindow.cc
./src/gui/SectionTab.cc
)
SET(MAIN_SRC
./src/main/XMLReader.cc
./src/main/INIParser.cc
./src/main/dimensions.cc
./src/main/settings.cc
./src/main/common.cc
./src/main/Error.cc
./src/main/expressions.cc
./src/main/inishell.cc
./src/main/SyntaxHighlighter.cc
./src/main/os.cc
./src/main/main.cc
./src/main/colors.cc
)
SET(SOURCES ${PANELS_SRC} ${GUI_SRC} ${MAIN_SRC})
#ifndef CONFIG_H_IN
#define CONFIG_H_IN
#define PROJECT_NAME "inishell"
#define APP_VERSION_STR "2.0.7"
#endif // INCLUDE_GUARD
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment