diff --git a/CMakeLists.txt b/CMakeLists.txt index ce38bdbf..ec6ba1e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,10 +20,13 @@ # ############################################################################## cmake_minimum_required(VERSION 3.3.2 FATAL_ERROR) -cmake_policy(SET CMP0057 NEW) +cmake_policy(VERSION 3.3.2) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() +if(POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() # ############ # Define Project @@ -67,6 +70,12 @@ if(NOT IS_SUBPROJECT) message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------") endif() +# Testing +option(Build_Tests "Build tests" ON) +if(Build_Tests) + enable_testing() +endif() + # Export the list of compile-commands into compile_commands.json set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -103,9 +112,7 @@ add_subdirectory(deps) add_subdirectory(c++/app4triqs) # Tests -option(Build_Tests "Build tests" ON) -if(Build_Tests AND NOT IS_SUBPROJECT) - enable_testing() +if(Build_Tests) add_subdirectory(test) endif() diff --git a/deps/external_dependency.cmake b/deps/external_dependency.cmake index 435e1720..798f04cd 100644 --- a/deps/external_dependency.cmake +++ b/deps/external_dependency.cmake @@ -45,6 +45,7 @@ function(external_dependency) message(STATUS " =============== Configuring Dependency ${ARGV0} =============== ") if(ARG_EXCLUDE_FROM_ALL) set(subdir_opts EXCLUDE_FROM_ALL) + set(Build_Tests OFF) endif() if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}) message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}.")