@@ -37,154 +37,4 @@ option(ENABLE_TEST "enable test builds" OFF)
3737
3838# ----------------------------------------------- Do not change --------------------------------------------------------
3939# ======================================================================================================================
40-
41- set (CMAKE_COMPILE_WARNING_AS_ERROR ON )
42-
43- if (CLANG_TIDY)
44- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
45- if (${CLANG_TIDY_NO_ERRORS} )
46- set (CLANG_TIDY_CONFIG_FILE ${CMAKE_SOURCE_DIR} /.clang-tidy-noerrors)
47- else ()
48- set (CLANG_TIDY_CONFIG_FILE ${CMAKE_SOURCE_DIR} /.clang-tidy)
49- endif ()
50-
51- set (CMAKE_CXX_CLANG_TIDY
52- clang-tidy
53- -config-file=${CLANG_TIDY_CONFIG_FILE} )
54- message (STATUS "clang-tidy enabled: ${CLANG_TIDY_CONFIG_FILE} " )
55- else ()
56- message (WARNING "clang-tidy requested, but only available if clang is selected as compiler" )
57- endif ()
58- endif ()
59-
60- # add executable
61- add_executable (${Target} )
62- install (TARGETS ${Target} )
63-
64- # set source and libraries directory
65- add_subdirectory ("src" )
66- add_subdirectory ("libs" )
67-
68- include (warnings.cmake)
69- include (define.cmake)
70- include (compileropts.cmake)
71-
72- # force C++ Standard and disable/enable compiler specific extensions
73- set_target_properties (${Target} PROPERTIES
74- CXX_STANDARD ${STANDARD}
75- CXX_STANDARD_REQUIRED ON
76- CXX_EXTENSIONS ${COMPILER_EXTENSIONS}
77- )
78-
79- # compiler definitions and options
80- set_definitions(${Target} )
81- if (ENABLE_MULTITHREADING AND OPENMP)
82- set_options(${Target} ON )
83- else ()
84- set_options(${Target} OFF )
85- endif ()
86-
87- if (COMPILER_WARNINGS)
88- enable_warnings(${Target} )
89- message (STATUS "Compiler warnings enabled." )
90- else ()
91- disable_warnings(${Target} )
92- message (STATUS "Compiler warnings disabled." )
93- endif ()
94-
95- if (ENABLE_MULTITHREADING)
96- # required by threading lib (std::thread)
97- set (THREADS_PREFER_PTHREAD_FLAG ON )
98- find_package (Threads REQUIRED)
99- target_link_libraries (${Target} PRIVATE Threads::Threads)
100- endif ()
101-
102- # lto
103- if (LTO_ENABLED)
104- include (CheckIPOSupported)
105- check_ipo_supported(RESULT ipo_supported OUTPUT error)
106- if (ipo_supported)
107- message (STATUS "IPO / LTO enabled" )
108- set_property (TARGET ${Target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE )
109- else ()
110- message (STATUS "IPO / LTO not supported: <${error} >" )
111- endif ()
112- endif ()
113-
114- if (BUILD_DOC)
115- # doxygen documentation (https://vicrucann.github.io/tutorials/quick-cmake-doxygen/)
116- # check if Doxygen is installed
117- find_package (Doxygen)
118- if (DOXYGEN_FOUND)
119- # set input and output files
120- set (DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR} /Doxyfile.in)
121- set (DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR} /Doxyfile)
122-
123- if (EXISTS ${DOXYGEN_IN} )
124- # request to configure the file
125- configure_file (${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
126- message (STATUS "Doxygen configured" )
127-
128- # note the option ALL which allows to build the docs together with the application
129- add_custom_target (doc_doxygen_${Target} ALL
130- COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
131- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
132- COMMENT "Generating API documentation with Doxygen"
133- VERBATIM )
134- message (STATUS "Added target doc_doxygen_${Target} " )
135-
136- if (TARGET doc_doxygen)
137- add_dependencies (doc_doxygen doc_doxygen_${Target} )
138- else ()
139- add_custom_target (doc_doxygen DEPENDS doc_doxygen_${Target} )
140- endif ()
141- else ()
142- message (WARNING "doxygen documentation requested, but file ${DOXYGEN_IN} does not exist." )
143- endif ()
144- else (DOXYGEN_FOUND)
145- message (WARNING "Doxygen must be installed and accessible to generate the doxygen documentation." )
146- endif (DOXYGEN_FOUND)
147- endif ()
148-
149- # add clang format target
150- if (CLANG_FORMAT)
151- set (CLANG_FORMAT_FILE ${CMAKE_CURRENT_SOURCE_DIR} /.clang-format)
152-
153- if (EXISTS ${CLANG_FORMAT_FILE} )
154- include (ClangFormat.cmake)
155- target_clangformat_setup(${Target} )
156- message (STATUS "Added clang format target(s)" )
157- else ()
158- message (WARNING "Clang format enabled, but file ${CLANG_FORMAT_FILE} does not exist" )
159- endif ()
160- endif ()
161-
162- # add test targets
163- if (ENABLE_TEST)
164- enable_testing ()
165- add_subdirectory ("test" )
166- endif ()
167-
168- # generate version_info.cpp
169- # output is not the acutal generated file --> command is always executed
170- add_custom_command (
171- OUTPUT
172- ${CMAKE_SOURCE_DIR} /src/generated /version_info_cpp
173-
174- COMMAND
175- bash ${CMAKE_SOURCE_DIR} /scripts/gen_version_info_cpp.sh ${PROJECT_NAME}
176-
177- WORKING_DIRECTORY
178- ${CMAKE_SOURCE_DIR}
179- )
180-
181- execute_process (
182- COMMAND bash "${CMAKE_SOURCE_DIR} /scripts/gen_version_info_cpp.sh" ${PROJECT_NAME}
183- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
184- )
185-
186- add_custom_target (${Target} _generated_version_info
187- DEPENDS ${CMAKE_SOURCE_DIR} /src/generated /version_info_cpp
188- )
189-
190- add_dependencies (${Target} ${Target} _generated_version_info)
40+ include (cmake_files/setup.cmake)
0 commit comments