Skip to content

Commit 8d77d01

Browse files
Manu343726foonathan
authored andcommitted
Allow building tool, example, and tests from upper cmake projects (standardese#63)
Now a subdirectory will by default only build the library, a standalone build will build everything.
1 parent 9edbbe5 commit 8d77d01

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

CMakeLists.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ endif()
1414
option(CPPAST_ENABLE_ASSERTIONS "whether or not to enable internal assertions for the cppast library" ${default_assertions})
1515
option(CPPAST_ENABLE_PRECONDITION_CHECKS "whether or not to enable precondition checks" ON)
1616

17-
option(CPPAST_BUILD_TEST "whether or not to build the tests" ON)
18-
option(CPPAST_BUILD_EXAMPLE "whether or not to build the examples" ON)
19-
option(CPPAST_BUILD_TOOL "whether or not to build the tool" ON)
17+
option(CPPAST_BUILD_TEST "whether or not to build the tests" OFF)
18+
option(CPPAST_BUILD_EXAMPLE "whether or not to build the examples" OFF)
19+
option(CPPAST_BUILD_TOOL "whether or not to build the tool" OFF)
2020
option(BUILD_TESTING "build test" OFF) # The ctest variable for building tests
2121

22-
if((${CPPAST_BUILD_TEST} OR ${BUILD_TESTING}) AND (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
22+
if((${CPPAST_BUILD_TEST} OR ${BUILD_TESTING}) OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
2323
set(build_test ON)
2424
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # for the self integration test
2525
else()
2626
set(build_test OFF)
2727
endif()
2828

29-
if(${CPPAST_BUILD_EXAMPLE} AND (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
29+
if(${CPPAST_BUILD_EXAMPLE} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
3030
set(build_example ON)
3131
else()
3232
set(build_example OFF)
3333
endif()
3434

35-
if(${CPPAST_BUILD_TOOL} AND (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
35+
if(${CPPAST_BUILD_TOOL} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
3636
set(build_tool ON)
3737
else()
3838
set(build_tool OFF)

0 commit comments

Comments
 (0)