diff options
author | Brad King <brad.king@kitware.com> | 2020-04-16 15:04:27 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-16 15:05:04 (GMT) |
commit | 854cc83a76a021301c49ae27cbd8924a2b5c97a5 (patch) | |
tree | cb4648e0c9536293763e709846c25cc2bd2b1466 /Tests | |
parent | b9b69774ee891e742bdeee6bf0afee96cbb970b3 (diff) | |
parent | a4173ef1658078d4dde186489e136c805b370410 (diff) | |
download | CMake-854cc83a76a021301c49ae27cbd8924a2b5c97a5.zip CMake-854cc83a76a021301c49ae27cbd8924a2b5c97a5.tar.gz CMake-854cc83a76a021301c49ae27cbd8924a2b5c97a5.tar.bz2 |
Merge topic 'makefile-target-special'
a4173ef165 Tests: Enable coverage of special chars in include dirs for Makefiles
d74e651b78 Makefiles: Re-implement makefile target path escaping and quoting
031bfaa865 Makefiles: Factor out makefile target path escaping and quoting
ca343dad07 Makefiles: Convert paths with '#' on command-lines to short path on Windows
af7de05853 Makefiles: Do not use '\#' escape sequence with Windows-style make tools
1639ee70ef cmDepends: Update types to always use a Makefile generator
413d26030f cmGlobalNinjaGenerator: Remove outdated comment
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4605
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/IncludeDirectories/CMakeLists.txt | 41 | ||||
-rw-r--r-- | Tests/IncludeDirectories/main.cpp | 3 | ||||
-rw-r--r-- | Tests/TryCompile/CMakeLists.txt | 2 |
4 files changed, 34 insertions, 14 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6428235..cc2931b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3477,6 +3477,8 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH --build-two-config ${build_generator_args} --build-project IncludeDirectories + --build-options + -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES} --test-command IncludeDirectories) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index 838a236..eb08676 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -66,21 +66,36 @@ else() endif() # Test escaping of special characters in include directory paths. -# FIXME: Implement full support in Makefile generators -if(NOT CMAKE_GENERATOR MATCHES "Make") - set(special_chars "~@#$%^&=[]{}()!'") - if(NOT CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008") - string(APPEND special_chars ",") - endif() - if(NOT WIN32 AND NOT CYGWIN) - string(APPEND special_chars "*?<>") - endif() - set(special_dir "${CMAKE_CURRENT_BINARY_DIR}/special-${special_chars}-include") - file(WRITE "${special_dir}/SpecialDir.h" "#define SPECIAL_DIR_H\n") +set(special_chars "~@%&{}()!'") +if(NOT CMAKE_GENERATOR STREQUAL "Watcom WMake") + # Watcom seems to have no way to encode these characters. + string(APPEND special_chars "#=[]") +endif() +if(NOT (MINGW AND CMAKE_GENERATOR MATCHES "(Unix|MSYS) Makefiles")) + # FIXME: Dependencies work but command-line generation does not handle '$'. + string(APPEND special_chars "$") +endif() +if(NOT CMAKE_GENERATOR MATCHES "(Borland|NMake) Makefiles") + # NMake and Borland seem to have no way to encode a single '^'. + string(APPEND special_chars "^") +endif() +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 9 2008|Watcom WMake") + # The vcproj format separates values with ','. + string(APPEND special_chars ",") +endif() +if(NOT WIN32 AND NOT CYGWIN) + string(APPEND special_chars "*?<>") +endif() +set(special_dir "${CMAKE_CURRENT_BINARY_DIR}/special-${special_chars}-include") +file(WRITE "${special_dir}/SpecialDir.h" "#define SPECIAL_DIR_H\n") +target_include_directories(IncludeDirectories PRIVATE "${special_dir}") +target_compile_definitions(IncludeDirectories PRIVATE INCLUDE_SPECIAL_DIR) + +if(MAKE_SUPPORTS_SPACES) set(special_space_dir "${CMAKE_CURRENT_BINARY_DIR}/special-space ${special_chars}-include") file(WRITE "${special_space_dir}/SpecialSpaceDir.h" "#define SPECIAL_SPACE_DIR_H\n") - target_include_directories(IncludeDirectories PRIVATE "${special_dir}" "${special_space_dir}") - target_compile_definitions(IncludeDirectories PRIVATE INCLUDE_SPECIAL_DIR) + target_include_directories(IncludeDirectories PRIVATE "${special_space_dir}") + target_compile_definitions(IncludeDirectories PRIVATE INCLUDE_SPECIAL_SPACE_DIR) endif() add_library(ordertest ordertest.cpp) diff --git a/Tests/IncludeDirectories/main.cpp b/Tests/IncludeDirectories/main.cpp index 7368ee9..6dc88e2 100644 --- a/Tests/IncludeDirectories/main.cpp +++ b/Tests/IncludeDirectories/main.cpp @@ -8,6 +8,9 @@ # ifndef SPECIAL_DIR_H # error "SPECIAL_DIR_H not defined" # endif +#endif + +#ifdef INCLUDE_SPECIAL_SPACE_DIR # include "SpecialSpaceDir.h" # ifndef SPECIAL_SPACE_DIR_H # error "SPECIAL_SPACE_DIR_H not defined" diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 9ec9b70..df921d8 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -187,7 +187,7 @@ try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles") string(REPLACE "\n" "\n " output " ${output}") message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}") -elseif(NOT output MATCHES [[(bad#source\.c|bad\\)]]) +elseif(NOT output MATCHES [[(bad#source\.c|bad\.c|bad')]]) string(REPLACE "\n" "\n " output " ${output}") message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}") else() |