@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.20)
2
2
project (ansible2cxx VERSION 1.0 LANGUAGES CXX)
3
3
4
4
set (CMAKE_CXX_STANDARD 17)
5
+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
6
+
7
+ set (CMAKE_POSITION_INDEPENDENT_CODE ON )
5
8
6
9
# available toolchains out of the box (see "toolchains" directory):
7
10
# Linux_amd64 = x86_64 / AMD64 / x64 Architectures
@@ -40,46 +43,24 @@ file(GLOB LOCAL_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/include/*")
40
43
include_directories (${LOCAL_INCLUDE_DIRS} )
41
44
include_directories (external/yaml-cpp/include )
42
45
43
- file (GLOB_RECURSE UTIL_SOURCES "${CMAKE_SOURCE_DIR} /src/Utils/**.cpp" "${CMAKE_SOURCE_DIR} /src/Utils/**/*.cpp" )
44
- file (GLOB_RECURSE APP_SOURCES "${CMAKE_SOURCE_DIR} /src/Application/**.cpp" "${CMAKE_SOURCE_DIR} /src/Application/**/*.cpp" )
46
+ file (GLOB_RECURSE Ansible2Cxx_UTIL_SOURCES "${CMAKE_SOURCE_DIR} /src/Utils/**.cpp" "${CMAKE_SOURCE_DIR} /src/Utils/**/*.cpp" )
47
+ file (GLOB_RECURSE Ansible2Cxx_APP_SOURCES "${CMAKE_SOURCE_DIR} /src/Application/**.cpp" "${CMAKE_SOURCE_DIR} /src/Application/**/*.cpp" "${CMAKE_SOURCE_DIR} /src/Application/**/*.h" "${CMAKE_SOURCE_DIR} /src/Application/**/*.hpp" )
48
+
49
+ add_library (ansible2cxx-utils STATIC "${Ansible2Cxx_UTIL_SOURCES} " )
45
50
46
- add_library (ansible2cxx-utils STATIC "${UTIL_SOURCES} " )
51
+ file (GLOB_RECURSE Ansible2Cxx_PkgAPI_SOURCES "${CMAKE_SOURCE_DIR} /src/PkgAPI/**.cpp" )
52
+ add_library (ansible2cxx-pkg_api STATIC "${Ansible2Cxx_PkgAPI_SOURCES} " )
53
+ target_link_libraries (ansible2cxx-pkg_api PRIVATE ansible2cxx-utils)
47
54
48
55
file (GLOB_RECURSE Ansible2Cxx_API_SOURCES "${CMAKE_SOURCE_DIR} /src/API/**.cpp" )
49
56
add_library (ansible2cxx-api STATIC "${Ansible2Cxx_API_SOURCES} " )
50
- target_link_libraries (ansible2cxx-api PRIVATE ansible2cxx-utils)
51
-
52
- add_executable (ansible2cxx "${APP_SOURCES} " )
53
- target_link_libraries (ansible2cxx PRIVATE ansible2cxx-utils yaml-cpp)
54
-
55
- if (${APP_SYSTEM_ARCH} STREQUAL "x86_64" )
56
- if (${APP_SYSTEM_TARGET} STREQUAL "Linux" )
57
- find_package (Qt6 REQUIRED COMPONENTS Widgets Core)
58
- include_directories (${Qt6Widgets_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} )
59
- endif ()
60
-
61
- file (GLOB_RECURSE APP_GUI_WIN64_SOURCES "${CMAKE_SOURCE_DIR} /src/ApplicationGUI/Win64/**.cpp" "${CMAKE_SOURCE_DIR} /src/ApplicationGUI/Win64/**/*.cpp" )
62
- file (GLOB_RECURSE APP_GUI_LINUX_SOURCES "${CMAKE_SOURCE_DIR} /src/ApplicationGUI/Qt/**.cpp" "${CMAKE_SOURCE_DIR} /src/ApplicationGUI/Qt/**/*.cpp" )
63
- file (GLOB APP_GUI_GLOB_SOURCES "${CMAKE_SOURCE_DIR} /src/ApplicationGUI/**.cpp" "${CMAKE_SOURCE_DIR} /src/ApplicationGUI/**.h" )
57
+ target_link_libraries (ansible2cxx-api PRIVATE ansible2cxx-utils ansible2cxx-pkg_api)
64
58
65
- set (APP_GUI_SOURCES ${APP_GUI_GLOB_SOURCES} )
66
-
67
- if ("${APP_SYSTEM_TARGET} " STREQUAL "Linux" )
68
- list (APPEND APP_GUI_SOURCES ${APP_GUI_LINUX_SOURCES} )
69
- elseif ("${APP_SYSTEM_TARGET} " STREQUAL "Win64" )
70
- list (APPEND APP_GUI_SOURCES ${APP_GUI_WIN64_SOURCES} )
71
- endif ()
72
-
73
- add_executable (ansible2cxx-gui "${APP_GUI_SOURCES} " )
74
- target_link_libraries (ansible2cxx-gui PRIVATE ansible2cxx-utils yaml-cpp)
75
-
76
- if (${APP_SYSTEM_TARGET} STREQUAL "Linux" )
77
- target_link_libraries (ansible2cxx-gui PRIVATE Qt6::Widgets Qt6::Core)
78
- endif ()
79
- endif ()
59
+ add_executable (ansible2cxx "${Ansible2Cxx_APP_SOURCES} " )
60
+ target_link_libraries (ansible2cxx PRIVATE ansible2cxx-pkg_api ansible2cxx-api ansible2cxx-utils yaml-cpp)
80
61
81
62
if (EXISTS "${CMAKE_SOURCE_DIR} /src/TestCode.cpp" )
82
- message ("$ Found TestCode.cpp" )
63
+ message (STATUS " Found TestCode.cpp" )
83
64
add_executable (ansible2cxx-test "src/TestCode.cpp" )
84
65
target_link_libraries (ansible2cxx-test PRIVATE ansible2cxx-utils yaml-cpp)
85
66
endif ()
0 commit comments