From 8d77d011ac1cff799694d309078c1b176dff4ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manu=20S=C3=A1nchez?= Date: Fri, 13 Jul 2018 11:03:12 +0200 Subject: [PATCH] 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. --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 199f835..2502eb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)