diff options
author | Victor Romero <romerosanchezv@gmail.com> | 2019-06-06 10:24:28 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2019-06-06 10:24:28 +0300 |
commit | 4cd0de67de9cc64b72abc11489a29959ac4e18ec (patch) | |
tree | a878671eb03136d1977e4f71bd5eb56ca37f4fbb | |
parent | 5037da9f7c9b49ca6dfa64b51bbc67b94f470688 (diff) | |
download | bdwgc-4cd0de67de9cc64b72abc11489a29959ac4e18ec.tar.gz |
Do not build the tests by default (CMake)
Issue #281 (bdwgc).
build_cord and build_tests options are introduced in the CMake script.
* CMakeLists.txt (build_cord): Add option (on by default); add comment.
* CMakeLists.txt (build_tests): Add option (off by default).
* CMakeLists.txt (cord): Specify add_subdirectory only if build_cord.
* CMakeLists.txt (tests): Specify add_subdirectory only if build_tests.
* cord/CMakeLists.txt: Skip cordtest and de tests unless build_tests.
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | cord/CMakeLists.txt | 26 |
2 files changed, 23 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d386ca5..4175e07a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,9 @@ include(CTest) cmake_minimum_required(VERSION 3.1) +# Customize the build by passing "-D<option_name>=ON|OFF" in the command line. +option(build_cord "Build cord library" ON) +option(build_tests "Build tests" OFF) option(enable_threads "TODO" OFF) #TODO Support it option(enable_parallel_mark "Parallelize marking and free list construction" ON) option(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) @@ -253,6 +256,10 @@ set_target_properties(gcmt-lib PROPERTIES add_library(gcmt-dll SHARED ${SRC}) -add_subdirectory(cord) +if (build_cord) + add_subdirectory(cord) +endif() -add_subdirectory(tests) +if (build_tests) + add_subdirectory(tests) +endif() diff --git a/cord/CMakeLists.txt b/cord/CMakeLists.txt index 1fb27e96..a0a8a7b3 100644 --- a/cord/CMakeLists.txt +++ b/cord/CMakeLists.txt @@ -13,17 +13,19 @@ # TODO add_library(cord ...) -add_executable(cordtest cordbscs.c cordprnt.c cordxtra.c - tests/cordtest.c) -set_target_properties(cordtest PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL) -target_link_libraries(cordtest gc-lib) -add_test(NAME cordtest COMMAND cordtest) +if (build_tests) + add_executable(cordtest cordbscs.c cordprnt.c cordxtra.c + tests/cordtest.c) + set_target_properties(cordtest PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL) + target_link_libraries(cordtest gc-lib) + add_test(NAME cordtest COMMAND cordtest) -if (WIN32) - add_executable(de cordbscs.c cordxtra.c - tests/de.c tests/de_win.c) - set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE) - set_target_properties(de PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL) - target_link_libraries(de gc-lib) - target_link_libraries(de gdi32) + if (WIN32) + add_executable(de cordbscs.c cordxtra.c + tests/de.c tests/de_win.c) + set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE) + set_target_properties(de PROPERTIES COMPILE_DEFINITIONS GC_NOT_DLL) + target_link_libraries(de gc-lib) + target_link_libraries(de gdi32) + endif(WIN32) endif() |