Allow building tool, example, and tests from upper cmake projects (#63)
Now a subdirectory will by default only build the library, a standalone build will build everything.
This commit is contained in:
parent
9edbbe5f82
commit
8d77d011ac
1 changed files with 6 additions and 6 deletions
|
|
@ -14,25 +14,25 @@ endif()
|
|||
option(CPPAST_ENABLE_ASSERTIONS "whether or not to enable internal assertions for the cppast library" ${default_assertions})
|
||||
option(CPPAST_ENABLE_PRECONDITION_CHECKS "whether or not to enable precondition checks" ON)
|
||||
|
||||
option(CPPAST_BUILD_TEST "whether or not to build the tests" ON)
|
||||
option(CPPAST_BUILD_EXAMPLE "whether or not to build the examples" ON)
|
||||
option(CPPAST_BUILD_TOOL "whether or not to build the tool" ON)
|
||||
option(CPPAST_BUILD_TEST "whether or not to build the tests" OFF)
|
||||
option(CPPAST_BUILD_EXAMPLE "whether or not to build the examples" OFF)
|
||||
option(CPPAST_BUILD_TOOL "whether or not to build the tool" OFF)
|
||||
option(BUILD_TESTING "build test" OFF) # The ctest variable for building tests
|
||||
|
||||
if((${CPPAST_BUILD_TEST} OR ${BUILD_TESTING}) AND (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
if((${CPPAST_BUILD_TEST} OR ${BUILD_TESTING}) OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
set(build_test ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # for the self integration test
|
||||
else()
|
||||
set(build_test OFF)
|
||||
endif()
|
||||
|
||||
if(${CPPAST_BUILD_EXAMPLE} AND (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
if(${CPPAST_BUILD_EXAMPLE} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
set(build_example ON)
|
||||
else()
|
||||
set(build_example OFF)
|
||||
endif()
|
||||
|
||||
if(${CPPAST_BUILD_TOOL} AND (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
if(${CPPAST_BUILD_TOOL} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
set(build_tool ON)
|
||||
else()
|
||||
set(build_tool OFF)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue