summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/target_link_directories
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-12-13 21:55:00 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-02-26 15:38:42 (GMT)
commit461efa7b51f5d63ab5e366af3a615a469ac0e65f (patch)
treed703f0e23d718fe225b70fffd09e028576c4d4e9 /Tests/RunCMake/target_link_directories
parent54d1268ed466c68845e01d28fc17f162f384ac39 (diff)
downloadCMake-461efa7b51f5d63ab5e366af3a615a469ac0e65f.zip
CMake-461efa7b51f5d63ab5e366af3a615a469ac0e65f.tar.gz
CMake-461efa7b51f5d63ab5e366af3a615a469ac0e65f.tar.bz2
Genex: Add $<LINK_LANGUAGE:...> and $<LINK_LANG_AND_ID:...>
This MR may help to solve issues #19757 and #18008 Fixes: #19965
Diffstat (limited to 'Tests/RunCMake/target_link_directories')
-rw-r--r--Tests/RunCMake/target_link_directories/CMP0099.cmake2
-rw-r--r--Tests/RunCMake/target_link_directories/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-check.cmake5
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-result.txt1
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-result.txt1
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-result.txt1
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-validation.cmake20
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE.cmake23
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-check.cmake5
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-result.txt1
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-check.cmake2
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-result.txt1
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-check.cmake4
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-result.txt1
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-validation.cmake26
-rw-r--r--Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID.cmake29
18 files changed, 139 insertions, 2 deletions
diff --git a/Tests/RunCMake/target_link_directories/CMP0099.cmake b/Tests/RunCMake/target_link_directories/CMP0099.cmake
index a2be279..aff1e33 100644
--- a/Tests/RunCMake/target_link_directories/CMP0099.cmake
+++ b/Tests/RunCMake/target_link_directories/CMP0099.cmake
@@ -5,7 +5,7 @@ set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
add_library(LinkDirs_interface INTERFACE)
-target_link_directories (LinkDirs_interface INTERFACE "/DIR_INTERFACE"})
+target_link_directories (LinkDirs_interface INTERFACE "/DIR_INTERFACE")
add_library(LinkDirs_static STATIC lib.c)
target_link_libraries (LinkDirs_static PRIVATE LinkDirs_interface)
diff --git a/Tests/RunCMake/target_link_directories/RunCMakeTest.cmake b/Tests/RunCMake/target_link_directories/RunCMakeTest.cmake
index a74ee25..699e871 100644
--- a/Tests/RunCMake/target_link_directories/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_directories/RunCMakeTest.cmake
@@ -21,10 +21,21 @@ if(RunCMake_GENERATOR MATCHES "(Ninja|Makefiles)" AND
set(VERBOSE -- -v)
endif()
+ run_cmake(genex_LINK_LANGUAGE)
+ run_cmake_target(genex_LINK_LANGUAGE interface LinkDirs_exe_interface --config Release ${VERBOSE})
+ run_cmake_target(genex_LINK_LANGUAGE basic LinkDirs_exe_c --config Release ${VERBOSE})
+ run_cmake_target(genex_LINK_LANGUAGE LINKER_LANGUAGE LinkDirs_exe_cxx --config Release ${VERBOSE})
+
+ run_cmake(genex_LINK_LANG_AND_ID)
+
+ run_cmake_target(genex_LINK_LANG_AND_ID interface LinkDirs_exe_interface --config Release ${VERBOSE})
+ run_cmake_target(genex_LINK_LANG_AND_ID basic LinkDirs_exe_c --config Release ${VERBOSE})
+ run_cmake_target(genex_LINK_LANG_AND_ID LINKER_LANGUAGE LinkDirs_exe_cxx --config Release ${VERBOSE})
+
+
run_cmake(CMP0099-NEW)
run_cmake_target(CMP0099-NEW basic LinkDirs_exe ${VERBOSE})
-
run_cmake(CMP0099-OLD)
run_cmake_target(CMP0099-OLD basic LinkDirs_exe ${VERBOSE})
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-check.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-check.cmake
new file mode 100644
index 0000000..aa39810
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-check.cmake
@@ -0,0 +1,5 @@
+
+set (VALID_LANG CXX)
+set (INVALID_LANG C)
+
+include ("${CMAKE_CURRENT_LIST_DIR}/genex_LINK_LANGUAGE-validation.cmake")
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-result.txt b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-LINKER_LANGUAGE-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-check.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-check.cmake
new file mode 100644
index 0000000..71f641d
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/genex_LINK_LANGUAGE-validation.cmake")
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-result.txt b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-basic-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-check.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-check.cmake
new file mode 100644
index 0000000..8313de6
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-check.cmake
@@ -0,0 +1,4 @@
+
+set (TYPE INTERFACE)
+
+include ("${CMAKE_CURRENT_LIST_DIR}/genex_LINK_LANGUAGE-validation.cmake")
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-result.txt b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-interface-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-validation.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-validation.cmake
new file mode 100644
index 0000000..298564e
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE-validation.cmake
@@ -0,0 +1,20 @@
+
+if (NOT VALID_LANG)
+ set (VALID_LANG C)
+endif()
+if (NOT INVALID_LANG)
+ set (INVALID_LANG CXX)
+endif()
+if (NOT TYPE)
+ set (TYPE EXE)
+endif()
+
+if (NOT actual_stdout MATCHES "DIR_${VALID_LANG}_${TYPE}")
+ set (RunCMake_TEST_FAILED "Not found expected 'DIR_${VALID_LANG}_${TYPE}'.")
+endif()
+if (actual_stdout MATCHES "DIR_${INVALID_LANG}_${TYPE}")
+ if (RunCMake_TEST_FAILED)
+ string (APPEND RunCMake_TEST_FAILED "\n")
+ endif()
+ string (APPEND RunCMake_TEST_FAILED "Found unexpected 'DIR_${INVALID_LANG}_${TYPE}'.")
+endif()
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE.cmake
new file mode 100644
index 0000000..1f266b1
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANGUAGE.cmake
@@ -0,0 +1,23 @@
+
+enable_language(C)
+enable_language(CXX)
+
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+
+add_library(LinkDirs_interface INTERFACE)
+target_link_directories (LinkDirs_interface INTERFACE "$<$<LINK_LANGUAGE:C>:/DIR_C_INTERFACE>"
+ "$<$<LINK_LANGUAGE:CXX>:/DIR_CXX_INTERFACE>")
+
+add_executable(LinkDirs_exe_interface exe.c)
+target_link_libraries (LinkDirs_exe_interface PRIVATE LinkDirs_interface)
+
+add_executable(LinkDirs_exe_c exe.c)
+target_link_directories (LinkDirs_exe_c PRIVATE "$<$<LINK_LANGUAGE:C>:/DIR_C_EXE>"
+ "$<$<LINK_LANGUAGE:CXX>:/DIR_CXX_EXE>")
+
+add_executable(LinkDirs_exe_cxx exe.c)
+target_link_directories (LinkDirs_exe_cxx PRIVATE "$<$<LINK_LANGUAGE:C>:/DIR_C_EXE>"
+ "$<$<LINK_LANGUAGE:CXX>:/DIR_CXX_EXE>")
+set_property (TARGET LinkDirs_exe_cxx PROPERTY LINKER_LANGUAGE CXX)
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-check.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-check.cmake
new file mode 100644
index 0000000..ed4f851
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-check.cmake
@@ -0,0 +1,5 @@
+
+set (VALID_LANG CXX)
+set (INVALID_LANG C)
+
+include ("${CMAKE_CURRENT_LIST_DIR}/genex_LINK_LANG_AND_ID-validation.cmake")
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-result.txt b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-LINKER_LANGUAGE-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-check.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-check.cmake
new file mode 100644
index 0000000..6bddee1
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-check.cmake
@@ -0,0 +1,2 @@
+
+include ("${CMAKE_CURRENT_LIST_DIR}/genex_LINK_LANG_AND_ID-validation.cmake")
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-result.txt b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-basic-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-check.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-check.cmake
new file mode 100644
index 0000000..a328738
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-check.cmake
@@ -0,0 +1,4 @@
+
+set (TYPE INTERFACE)
+
+include ("${CMAKE_CURRENT_LIST_DIR}/genex_LINK_LANG_AND_ID-validation.cmake")
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-result.txt b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-result.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-interface-result.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-validation.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-validation.cmake
new file mode 100644
index 0000000..9872953
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID-validation.cmake
@@ -0,0 +1,26 @@
+
+if (NOT VALID_LANG)
+ set (VALID_LANG C)
+endif()
+if (NOT INVALID_LANG)
+ set (INVALID_LANG CXX)
+endif()
+if (NOT TYPE)
+ set (TYPE EXE)
+endif()
+
+if (NOT actual_stdout MATCHES "DIR_${VALID_LANG}_${TYPE}")
+ set (RunCMake_TEST_FAILED "Not found expected 'DIR_${VALID_LANG}_${TYPE}'.\n")
+endif()
+if (actual_stdout MATCHES "DIR_${INVALID_LANG}_${TYPE}")
+ if (RunCMake_TEST_FAILED)
+ string (APPEND RunCMake_TEST_FAILED "\n")
+ endif()
+ string (APPEND RunCMake_TEST_FAILED "Found unexpected 'DIR_${INVALID_LANG}_${TYPE} '.")
+endif()
+if (actual_stdout MATCHES "DIR_(${VALID_LANG}|${INVALID_LANG})_BADID_${TYPE}")
+ if (RunCMake_TEST_FAILED)
+ string (APPEND RunCMake_TEST_FAILED "\n")
+ endif()
+ string (APPEND RunCMake_TEST_FAILED "Found unexpected 'DIR_(${VALID_LANG}|${INVALID_LANG})_BADID_${TYPE}'.")
+endif()
diff --git a/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID.cmake b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID.cmake
new file mode 100644
index 0000000..eb3b342
--- /dev/null
+++ b/Tests/RunCMake/target_link_directories/genex_LINK_LANG_AND_ID.cmake
@@ -0,0 +1,29 @@
+
+enable_language(C)
+enable_language(CXX)
+
+set(CMAKE_VERBOSE_MAKEFILE TRUE)
+set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
+
+add_library(LinkDirs_interface INTERFACE)
+target_link_directories (LinkDirs_interface INTERFACE $<$<LINK_LANG_AND_ID:C,${CMAKE_C_COMPILER_ID}>:/DIR_C_INTERFACE>
+ $<$<LINK_LANG_AND_ID:CXX,${CMAKE_CXX_COMPILER_ID}>:/DIR_CXX_INTERFACE>
+ $<$<LINK_LANG_AND_ID:C,BADID>:/DIR_C_BADID_INTERFACE>
+ $<$<LINK_LANG_AND_ID:CXX,BADID>:/DIR_CXX_BADID_INTERFACE>)
+
+add_executable(LinkDirs_exe_interface exe.c)
+target_link_libraries (LinkDirs_exe_interface PRIVATE LinkDirs_interface)
+
+add_executable(LinkDirs_exe_c exe.c)
+target_link_options (LinkDirs_exe_c PRIVATE $<$<LINK_LANG_AND_ID:C,${CMAKE_C_COMPILER_ID}>:/DIR_C_EXE>
+ $<$<LINK_LANG_AND_ID:CXX,${CMAKE_CXX_COMPILER_ID}>:/DIR_CXX_EXE>
+ $<$<LINK_LANG_AND_ID:C,BADID>:/DIR_C_BADID_EXE>
+ $<$<LINK_LANG_AND_ID:CXX,BADID>:/DIR_CXX_BADID_EXE>)
+
+add_executable(LinkDirs_exe_cxx exe.c)
+target_link_directories (LinkDirs_exe_cxx PRIVATE $<$<LINK_LANG_AND_ID:C,${CMAKE_C_COMPILER_ID}>:/DIR_C_EXE>
+ $<$<LINK_LANG_AND_ID:CXX,${CMAKE_CXX_COMPILER_ID}>:/DIR_CXX_EXE>
+ $<$<LINK_LANG_AND_ID:C,BADID>:/DIR_C_BADID_EXE>
+ $<$<LINK_LANG_AND_ID:CXX,BADID>:/DIR_CXX_BADID_EXE>)
+set_property (TARGET LinkDirs_exe_cxx PROPERTY LINKER_LANGUAGE CXX)