From 1c48075a71071bd240776580af1b950ca4416080 Mon Sep 17 00:00:00 2001 From: Willy Scheibel Date: Wed, 1 Feb 2017 10:16:13 +0100 Subject: [PATCH] Move policy declarations before including CompileOptions.cmake for test subproject (refs #44) --- source/tests/CMakeLists.txt | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index 3798a72..46de034 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -1,8 +1,9 @@ # -# Configure test project +# Configure test project and environment # +# CMake version cmake_minimum_required(VERSION 3.0 FATAL_ERROR) # Meta information about the project @@ -11,6 +12,13 @@ set(META_PROJECT_NAME "template") # Declare project project("${META_PROJECT_NAME}-tests" C CXX) +# Set policies +set_policy(CMP0028 NEW) # ENABLE CMP0028: Double colon in target name means ALIAS or IMPORTED target. +set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted. +set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default. +set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types. +set_policy(CMP0037 OLD) # DISABLE CMP0037: Target names should not be reserved and should match a validity pattern. + # Compiler settings and options if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake") @@ -23,16 +31,6 @@ else() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") endif() -# -# Setup test environment -# - -set_policy(CMP0028 NEW) # ENABLE CMP0028: Double colon in target name means ALIAS or IMPORTED target. -set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted. -set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default. -set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types. -set_policy(CMP0037 OLD) # DISABLE CMP0037: Target names should not be reserved and should match a validity pattern. - # Function: Build test and add command to execute it via target 'test' function(add_test_without_ctest target) add_subdirectory(${target})