Tests: Shorten paths in CompileDefinitions

Shorten the add_definitions command test directory and target names to
avoid creating really long paths that fail with some tools on Windows.
While at it, remove unnecessary project() command calls.
This commit is contained in:
Brad King 2015-01-25 08:09:10 -05:00
parent c99e19a4ac
commit 494f6e8d5b
4 changed files with 19 additions and 27 deletions

View File

@ -1,6 +1,4 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(CompileDefinitions) project(CompileDefinitions)
if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6") if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6")
@ -19,8 +17,8 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS
"BUILD_CONFIG_NAME=\"$<CONFIGURATION>\"" "BUILD_CONFIG_NAME=\"$<CONFIGURATION>\""
) )
add_subdirectory(add_definitions_command) add_subdirectory(add_def_cmd)
add_subdirectory(target_prop) add_subdirectory(target_prop)
add_subdirectory(add_definitions_command_with_target_prop) add_subdirectory(add_def_cmd_tprop)
add_executable(CompileDefinitions runtest.c) add_executable(CompileDefinitions runtest.c)

View File

@ -1,6 +1,3 @@
project(add_definitions_command)
add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun") add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun")
if (NOT NO_SPACES_IN_DEFINE_VALUES) if (NOT NO_SPACES_IN_DEFINE_VALUES)
add_definitions(-DCMAKE_IS_REALLY="Very Fun") add_definitions(-DCMAKE_IS_REALLY="Very Fun")
@ -12,4 +9,4 @@ endif()
add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun)
add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug> -DBUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>) add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug> -DBUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>)
add_executable(add_definitions_command_executable ../compiletest.cpp) add_executable(add_def_cmd_exe ../compiletest.cpp)

View File

@ -0,0 +1,16 @@
add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun)
add_executable(add_def_cmd_tprop_exe ../compiletest.cpp)
set_target_properties(add_def_cmd_tprop_exe PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun")
if (NOT NO_SPACES_IN_DEFINE_VALUES)
set_property(TARGET add_def_cmd_tprop_exe APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun")
endif()
add_definitions(-DCMAKE_IS_FUN)
set_property(TARGET add_def_cmd_tprop_exe APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun")
add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug>)
set_property(TARGET add_def_cmd_tprop_exe APPEND PROPERTY COMPILE_DEFINITIONS BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>)

View File

@ -1,19 +0,0 @@
project(add_definitions_command_with_target_prop)
add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun)
add_executable(add_definitions_command_with_target_prop_executable ../compiletest.cpp)
set_target_properties(add_definitions_command_with_target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun")
if (NOT NO_SPACES_IN_DEFINE_VALUES)
set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun")
endif()
add_definitions(-DCMAKE_IS_FUN)
set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun")
add_definitions(-DBUILD_IS_DEBUG=$<CONFIG:Debug>)
set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS BUILD_IS_NOT_DEBUG=$<NOT:$<CONFIG:Debug>>)