summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-01-11 19:32:13 (GMT)
committerBrad King <brad.king@kitware.com>2018-01-12 19:27:37 (GMT)
commit506fda1cf026a88378589009b62ca8bf633c5197 (patch)
tree2095056002a42332f5e8f2741daa29eb8880db10 /Tests/RunCMake
parentc2f79c98677d43fb8686f9e4309acddfae8f3dfd (diff)
downloadCMake-506fda1cf026a88378589009b62ca8bf633c5197.zip
CMake-506fda1cf026a88378589009b62ca8bf633c5197.tar.gz
CMake-506fda1cf026a88378589009b62ca8bf633c5197.tar.bz2
Genex: Enable COMPILE_LANGUAGE for INCLUDE_DIRECTORIES with VS and Xcode
The set of compile flags used for a target's C and C++ sources is based on the linker language. By default this is always the C++ flags if any C++ sources appear in the target, and otherwise the C flags. Therefore we can define the `COMPILE_LANGUAGE` generator expression in `INCLUDE_DIRECTORIES` to match the selected language. This is not exactly the same as for other generators, but is the best VS and Xcode can do. It is also sufficient for many use cases since the set of include directories for C and C++ is frequently similar but may be distinct from those for other languages like CUDA. Fixes: #17435
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt1
-rw-r--r--Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt9
-rw-r--r--Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt9
-rw-r--r--Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake5
-rw-r--r--Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp5
8 files changed, 0 insertions, 43 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 8eb8568..edd6c79 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -351,8 +351,6 @@ add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
set(IfacePaths_SOURCES_ARGS -DTEST_PROP=SOURCES)
add_RunCMake_test(IfacePaths_SOURCES TEST_DIR IfacePaths)
-add_RunCMake_test(COMPILE_LANGUAGE-genex)
-
# Matlab module related tests
if(CMake_TEST_FindMatlab)
add_RunCMake_test(FindMatlab)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt
deleted file mode 100644
index ef2163c..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_minimum_required(VERSION 3.1)
-project(${RunCMake_TEST} NONE)
-include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
deleted file mode 100644
index 0e13c48..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\):
- Error evaluating generator expression:
-
- \$<COMPILE_LANGUAGE:CXX>
-
- \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS,
- COMPILE_DEFINITIONS, and file\(GENERATE\) with the Visual Studio generator.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt
deleted file mode 100644
index 3f86dd4..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\):
- Error evaluating generator expression:
-
- \$<COMPILE_LANGUAGE:CXX>
-
- \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS,
- COMPILE_DEFINITIONS, and file\(GENERATE\) with the Xcode generator.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake
deleted file mode 100644
index 31771f6..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-enable_language(CXX)
-
-add_executable(main main.cpp)
-target_include_directories(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:anydir>)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake
deleted file mode 100644
index 9ed1b67..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-include(RunCMake)
-
-if (RunCMake_GENERATOR STREQUAL "Xcode")
- set(RunCMake-stderr-file IncludeDirectories-stderr-Xcode.txt)
- run_cmake(IncludeDirectories)
-elseif (RunCMake_GENERATOR MATCHES "Visual Studio")
- set(RunCMake-stderr-file IncludeDirectories-stderr-VS.txt)
- run_cmake(IncludeDirectories)
-endif()
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp b/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp
deleted file mode 100644
index 766b775..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/main.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-
-int main()
-{
- return 0;
-}