1
- cmake_minimum_required (VERSION 2.8 )
1
+ cmake_minimum_required (VERSION 3.11 ) # FetchContent requires CMake 3.11
2
2
project (chaiscript_extras )
3
3
4
4
if (BIICODE )
@@ -15,7 +15,6 @@ endif()
15
15
16
16
option (BUILD_IN_CPP17_MODE "Build with C++17 flags" FALSE )
17
17
18
-
19
18
if (CMAKE_COMPILER_IS_GNUCC )
20
19
option (ENABLE_COVERAGE "Enable Coverage Reporting in GCC" FALSE )
21
20
@@ -76,8 +75,6 @@ endif()
76
75
include (CTest )
77
76
enable_testing ()
78
77
79
-
80
-
81
78
if (CMAKE_COMPILER_IS_GNUCC )
82
79
execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION )
83
80
@@ -142,7 +139,6 @@ if(MINGW OR CYGWIN)
142
139
add_definitions (-O3 )
143
140
endif ()
144
141
145
-
146
142
if (NOT MULTITHREAD_SUPPORT_ENABLED )
147
143
add_definitions (-DCHAISCRIPT_NO_THREADS )
148
144
endif ()
@@ -166,75 +162,11 @@ if(CMAKE_HOST_UNIX)
166
162
167
163
add_definitions (-pthread )
168
164
endif ()
169
-
170
165
endif ()
171
166
172
- list (APPEND LIBS ${READLINE_LIB} )
173
-
174
167
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS} " )
175
168
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS} " )
176
169
set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS} " )
177
170
178
- # ChaiScript
179
- set (CHAISCRIPT_BRANCH v5.8.6 )
180
- set (CHAISCRIPT_VERSION 5.8.6 )
181
- file (DOWNLOAD https://github.com/ChaiScript/ChaiScript/archive/${CHAISCRIPT_BRANCH}.tar.gz "${CMAKE_BINARY_DIR} /chaiscript/chaiscript-${CHAISCRIPT_BRANCH} .tar.gz"
182
- INACTIVITY_TIMEOUT 180 TIMEOUT 180 TLS_VERIFY off )
183
- execute_process (COMMAND ${CMAKE_COMMAND} -E tar -xf "${CMAKE_BINARY_DIR} /chaiscript/chaiscript-${CHAISCRIPT_BRANCH} .tar.gz" "${CMAKE_BINARY_DIR} /chaiscript"
184
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR} /chaiscript" )
185
- include_directories ("${CMAKE_BINARY_DIR} /chaiscript/ChaiScript-${CHAISCRIPT_VERSION} /include" )
186
-
187
- # String ID
188
- set (STRING_ID_VERSION 674527b0dab0cca9cf846f3084e986d2783357eb )
189
- file (DOWNLOAD https://github.com/foonathan/string_id/archive/${STRING_ID_VERSION}.tar.gz "${CMAKE_BINARY_DIR} /string_id/string_id-${STRING_ID_VERSION} .tar.gz"
190
- INACTIVITY_TIMEOUT 180 TIMEOUT 180 TLS_VERIFY off )
191
- execute_process (COMMAND ${CMAKE_COMMAND} -E tar -xf "${CMAKE_BINARY_DIR} /string_id/string_id-${STRING_ID_VERSION} .tar.gz" "${CMAKE_BINARY_DIR} /string_id"
192
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR} /string_id" )
193
- file (RENAME "${CMAKE_BINARY_DIR} /string_id/string_id-${STRING_ID_VERSION} " "${CMAKE_BINARY_DIR} /string_id/string_id" )
194
- include_directories ("${CMAKE_BINARY_DIR} /string_id" )
195
- include_directories ("${CMAKE_SOURCE_DIR} /tests" )
196
-
197
- # Add catch tests macro
198
- macro (ADD_CATCH_TESTS executable )
199
- if (MSVC )
200
- file (TO_NATIVE_PATH "${QT_LIBRARY_DIR} " QT_LIB_PATH )
201
- set (NEWPATH "${QT_LIB_PATH} ;$ENV{PATH} " )
202
- else ()
203
- set (NEWPATH $ENV{PATH} )
204
- endif ()
205
-
206
- get_target_property (target_files ${executable} SOURCES )
207
-
208
- message ("Files: ${target_files} " )
209
-
210
- foreach (source ${target_files} )
211
- if (NOT "${source} " MATCHES "/moc_.*cxx" )
212
- string (REGEX MATCH .*cpp source "${source} " )
213
- if (source )
214
- file (READ "${source} " contents )
215
- string (REGEX MATCHALL "TEST_CASE\\ ([ ]*\" [^\" ]+\" " found_tests ${contents} )
216
- foreach (hit ${found_tests} )
217
- message ("Found Test: ${hit} " )
218
- string (REGEX REPLACE "TEST_CASE\\ ([ ]*(\" [^\" ]+\" ).*" "\\ 1" test_name ${hit} )
219
- add_test (${test_name} "${executable} " ${test_name} )
220
- set_tests_properties (${test_name} PROPERTIES TIMEOUT 660 ENVIRONMENT "PATH=${NEWPATH} " )
221
- endforeach ()
222
- endif ()
223
- endif ()
224
- endforeach ()
225
- endmacro ()
226
-
227
-
228
-
229
- add_executable (math_test tests/math.cpp )
230
- target_link_libraries (math_test ${LIBS} )
231
- ADD_CATCH_TESTS (math_test )
232
-
233
- # TODO: Fix String ID Tests
234
- #add_executable(string_id_test tests/string_id.cpp)
235
- #target_link_libraries(string_id_test ${LIBS})
236
- #ADD_CATCH_TESTS(string_id_test)
237
-
238
- add_executable (string_methods_test tests/string_methods.cpp )
239
- target_link_libraries (string_methods_test ${LIBS} )
240
- ADD_CATCH_TESTS (string_methods_test )
171
+ add_subdirectory (cmake )
172
+ add_subdirectory (tests )
0 commit comments