summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-13 15:00:55 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-13 15:01:03 (GMT)
commiteb28858586e0bb1be60ddcdc02fa8b649ebc69f0 (patch)
tree42c53d1e32d26b7041ab0028de9bce22e43e2d08 /Tests
parentda586cf1908d2a7ca933e4fd8309423ef05e455d (diff)
parent9be48c4d0bd4472d87264534e30ba79397bb691e (diff)
downloadCMake-eb28858586e0bb1be60ddcdc02fa8b649ebc69f0.zip
CMake-eb28858586e0bb1be60ddcdc02fa8b649ebc69f0.tar.gz
CMake-eb28858586e0bb1be60ddcdc02fa8b649ebc69f0.tar.bz2
Merge topic 'include-dir-special'
9be48c4d0b Tests: Add coverage for special characters in include directories dc0dc974a9 Xcode: Fix quoting of paths with square brackets Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4591
Diffstat (limited to 'Tests')
-rw-r--r--Tests/IncludeDirectories/CMakeLists.txt18
-rw-r--r--Tests/IncludeDirectories/main.cpp11
2 files changed, 29 insertions, 0 deletions
diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt
index fa3309f..838a236 100644
--- a/Tests/IncludeDirectories/CMakeLists.txt
+++ b/Tests/IncludeDirectories/CMakeLists.txt
@@ -65,6 +65,24 @@ else()
PROPERTIES COMPILE_FLAGS "-ITarProp")
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_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)
+endif()
+
add_library(ordertest ordertest.cpp)
target_include_directories(ordertest SYSTEM PUBLIC SystemIncludeDirectories/systemlib)
target_include_directories(ordertest PUBLIC SystemIncludeDirectories/userlib)
diff --git a/Tests/IncludeDirectories/main.cpp b/Tests/IncludeDirectories/main.cpp
index a59d27c..7368ee9 100644
--- a/Tests/IncludeDirectories/main.cpp
+++ b/Tests/IncludeDirectories/main.cpp
@@ -3,6 +3,17 @@
#include "SrcProp.h"
#include "TarProp.h"
+#ifdef INCLUDE_SPECIAL_DIR
+# include "SpecialDir.h"
+# ifndef SPECIAL_DIR_H
+# error "SPECIAL_DIR_H not defined"
+# endif
+# include "SpecialSpaceDir.h"
+# ifndef SPECIAL_SPACE_DIR_H
+# error "SPECIAL_SPACE_DIR_H not defined"
+# endif
+#endif
+
int main(int argc, char** argv)
{
return 0;