diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-06-17 08:51:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-17 12:02:33 (GMT) |
commit | 0951b1fe072da311e9adb55337ef364e2b6c01d0 (patch) | |
tree | d913a6530d58ae2e9197614107143a4cf8f8ba39 /Tests/RunCMake | |
parent | 2ae33f7ace90c0fbe0fae43de5a55d5d31dde4bc (diff) | |
download | CMake-0951b1fe072da311e9adb55337ef364e2b6c01d0.zip CMake-0951b1fe072da311e9adb55337ef364e2b6c01d0.tar.gz CMake-0951b1fe072da311e9adb55337ef364e2b6c01d0.tar.bz2 |
Tests: Split RunCMake.target_link_libraries test
Fixes: #20836
Diffstat (limited to 'Tests/RunCMake')
40 files changed, 201 insertions, 68 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 866e7c0..6c634b5 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -494,6 +494,9 @@ add_RunCMake_test(File_Generate) add_RunCMake_test(ExportWithoutLanguage) add_RunCMake_test(target_link_directories) add_RunCMake_test(target_link_libraries) +add_RunCMake_test(target_link_libraries-ALIAS) +add_RunCMake_test(target_link_libraries-LINK_LANGUAGE) +add_RunCMake_test(target_link_libraries-LINK_LANG_AND_ID) add_RunCMake_test(add_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}) add_RunCMake_test(target_link_options -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMake_TEST_CUDA=${CMake_TEST_CUDA}) diff --git a/Tests/RunCMake/target_link_libraries/AliasTargets.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake index 73f8a7d..73f8a7d 100644 --- a/Tests/RunCMake/target_link_libraries/AliasTargets.cmake +++ b/Tests/RunCMake/target_link_libraries-ALIAS/AliasTargets.cmake diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/CMakeLists.txt b/Tests/RunCMake/target_link_libraries-ALIAS/CMakeLists.txt new file mode 100644 index 0000000..9cf020f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-ALIAS/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake new file mode 100644 index 0000000..4d24a6e --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-ALIAS/RunCMakeTest.cmake @@ -0,0 +1,23 @@ +include(RunCMake) + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +set(RunCMake_TEST_OUTPUT_MERGE TRUE) +if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) +endif() +run_cmake(AliasTargets) +run_cmake_target(AliasTargets func func --config Release) +run_cmake_target(AliasTargets lib-local lib-local --config Release) +run_cmake_target(AliasTargets main-local main-local --config Release) +run_cmake_target(AliasTargets lib-global lib-global --config Release) +run_cmake_target(AliasTargets main-global main-global --config Release) +unset(RunCMake_TEST_OPTIONS) +unset(RunCMake_TEST_OUTPUT_MERGE) diff --git a/Tests/RunCMake/target_link_libraries/func.c b/Tests/RunCMake/target_link_libraries-ALIAS/func.c index 415a9bf..415a9bf 100644 --- a/Tests/RunCMake/target_link_libraries/func.c +++ b/Tests/RunCMake/target_link_libraries-ALIAS/func.c diff --git a/Tests/RunCMake/target_link_libraries-ALIAS/lib.c b/Tests/RunCMake/target_link_libraries-ALIAS/lib.c new file mode 100644 index 0000000..b2d1b66 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-ALIAS/lib.c @@ -0,0 +1,10 @@ + +#if defined(_WIN32) +__declspec(dllimport) +#endif + void func_c(); + +void lib() +{ + func_c(); +} diff --git a/Tests/RunCMake/target_link_libraries/main.c b/Tests/RunCMake/target_link_libraries-ALIAS/main.c index a908dea..a908dea 100644 --- a/Tests/RunCMake/target_link_libraries/main.c +++ b/Tests/RunCMake/target_link_libraries-ALIAS/main.c diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/CMakeLists.txt b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/CMakeLists.txt new file mode 100644 index 0000000..9cf020f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake new file mode 100644 index 0000000..487bf25 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/RunCMakeTest.cmake @@ -0,0 +1,41 @@ +include(RunCMake) + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +run_cmake(genex_LINK_LANGUAGE-bad-usage) + +if (RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Visual Studio|Xcode|Watcom WMake") + + run_cmake(genex_LINK_LANGUAGE-bad-mix-lang) + + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(genex_LINK_LANGUAGE) + + run_cmake_target(genex_LINK_LANGUAGE lib LinkLibraries_lib --config Release) + run_cmake_target(genex_LINK_LANGUAGE lib2 LinkLibraries_lib2 --config Release) + run_cmake_target(genex_LINK_LANGUAGE lib3 LinkLibraries_lib3 --config Release) + run_cmake_target(genex_LINK_LANGUAGE exe LinkLibraries_exe --config Release) + run_cmake_target(genex_LINK_LANGUAGE C_import LinkLibraries_C_import --config Release) + run_cmake_target(genex_LINK_LANGUAGE CXX_import LinkLibraries_CXX_import --config Release) + run_cmake_target(genex_LINK_LANGUAGE C_interface LinkLibraries_C_interface --config Release) + run_cmake_target(genex_LINK_LANGUAGE CXX_interface LinkLibraries_CXX_interface --config Release) + run_cmake_target(genex_LINK_LANGUAGE C_interface2 LinkLibraries_C_interface2 --config Release) + run_cmake_target(genex_LINK_LANGUAGE CXX_interface2 LinkLibraries_CXX_interface2 --config Release) + run_cmake_target(genex_LINK_LANGUAGE C_static LinkLibraries_C_static --config Release) + run_cmake_target(genex_LINK_LANGUAGE CXX_static LinkLibraries_CXX_static --config Release) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) + +endif() diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/empty.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/empty.c diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c new file mode 100644 index 0000000..415a9bf --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.c @@ -0,0 +1,7 @@ + +#if defined(_WIN32) +__declspec(dllexport) +#endif + void func_c() +{ +} diff --git a/Tests/RunCMake/target_link_libraries/func.cxx b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.cxx index a12caca..a12caca 100644 --- a/Tests/RunCMake/target_link_libraries/func.cxx +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/func.cxx diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-mix-lang-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-mix-lang-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-mix-lang-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-mix-lang-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-mix-lang-stderr.txt b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-mix-lang-stderr.txt index 2ecdc0c..2ecdc0c 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-mix-lang-stderr.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-mix-lang-stderr.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-mix-lang.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-mix-lang.cmake index e8efa75..e8efa75 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-mix-lang.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-mix-lang.cmake diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-usage-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-usage-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-usage-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-usage-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-usage-stderr.txt b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-usage-stderr.txt index 469f1fe..469f1fe 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-usage-stderr.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-usage-stderr.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-usage.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-usage.cmake index 81cfb0c..81cfb0c 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE-bad-usage.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE-bad-usage.cmake diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE.cmake index f3fe955..f3fe955 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANGUAGE.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/genex_LINK_LANGUAGE.cmake diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c new file mode 100644 index 0000000..b2d1b66 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/lib.c @@ -0,0 +1,10 @@ + +#if defined(_WIN32) +__declspec(dllimport) +#endif + void func_c(); + +void lib() +{ + func_c(); +} diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c new file mode 100644 index 0000000..a908dea --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.c @@ -0,0 +1,12 @@ + +#if defined(_WIN32) +__declspec(dllimport) +#endif + void func_c(); + +int main() +{ + func_c(); + + return 0; +} diff --git a/Tests/RunCMake/target_link_libraries/main.cxx b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.cxx index ffaa3b4..ffaa3b4 100644 --- a/Tests/RunCMake/target_link_libraries/main.cxx +++ b/Tests/RunCMake/target_link_libraries-LINK_LANGUAGE/main.cxx diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/CMakeLists.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/CMakeLists.txt new file mode 100644 index 0000000..9cf020f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.1) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/RunCMakeTest.cmake new file mode 100644 index 0000000..7cbc922 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/RunCMakeTest.cmake @@ -0,0 +1,38 @@ +include(RunCMake) + +macro(run_cmake_target test subtest target) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) + + unset(RunCMake_TEST_BINARY_DIR) + unset(RunCMake_TEST_NO_CLEAN) +endmacro() + +if (RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Visual Studio|Xcode|Watcom WMake") + + run_cmake(genex_LINK_LANG_AND_ID-bad-mix-lang) + + set(RunCMake_TEST_OUTPUT_MERGE TRUE) + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() + + run_cmake(genex_LINK_LANG_AND_ID) + + run_cmake_target(genex_LINK_LANG_AND_ID lib LinkLibraries_lib --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID lib2 LinkLibraries_lib2 --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID lib3 LinkLibraries_lib3 --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID exe LinkLibraries_exe --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID C_import LinkLibraries_C_import --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID CXX_import LinkLibraries_CXX_import --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID C_interface LinkLibraries_C_interface --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID CXX_interface LinkLibraries_CXX_interface --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID C_interface2 LinkLibraries_C_interface2 --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID CXX_interface2 LinkLibraries_CXX_interface2 --config Release) + run_cmake_target(genex_LINK_LANG_AND_ID CXX_static LinkLibraries_CXX_static --config Release) + + unset(RunCMake_TEST_OPTIONS) + unset(RunCMake_TEST_OUTPUT_MERGE) + +endif() diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/empty.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/empty.c diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c new file mode 100644 index 0000000..415a9bf --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.c @@ -0,0 +1,7 @@ + +#if defined(_WIN32) +__declspec(dllexport) +#endif + void func_c() +{ +} diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.cxx b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.cxx new file mode 100644 index 0000000..a12caca --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/func.cxx @@ -0,0 +1,7 @@ + +#if defined(_WIN32) +__declspec(dllexport) +#endif + void func_cxx() +{ +} diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-bad-mix-lang-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-bad-mix-lang-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-bad-mix-lang-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-bad-mix-lang-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-bad-mix-lang-stderr.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-bad-mix-lang-stderr.txt index 2ecdc0c..2ecdc0c 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-bad-mix-lang-stderr.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-bad-mix-lang-stderr.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-bad-mix-lang.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-bad-mix-lang.cmake index f80010a..f80010a 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-bad-mix-lang.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-bad-mix-lang.cmake diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-basic-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-basic-result.txt index 8d98f9d..8d98f9d 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-basic-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-basic-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-exe_c-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-exe_c-result.txt index 8d98f9d..8d98f9d 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-exe_c-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-exe_c-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-exe_cxx-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-exe_cxx-result.txt index 8d98f9d..8d98f9d 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-exe_cxx-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-exe_cxx-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-interface-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-interface-result.txt index 8d98f9d..8d98f9d 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-interface-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-interface-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-no_language-result.txt b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-no_language-result.txt index 573541a..573541a 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID-no_language-result.txt +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID-no_language-result.txt diff --git a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID.cmake b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID.cmake index 9feccd0..9feccd0 100644 --- a/Tests/RunCMake/target_link_libraries/genex_LINK_LANG_AND_ID.cmake +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/genex_LINK_LANG_AND_ID.cmake diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c new file mode 100644 index 0000000..b2d1b66 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/lib.c @@ -0,0 +1,10 @@ + +#if defined(_WIN32) +__declspec(dllimport) +#endif + void func_c(); + +void lib() +{ + func_c(); +} diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c new file mode 100644 index 0000000..a908dea --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.c @@ -0,0 +1,12 @@ + +#if defined(_WIN32) +__declspec(dllimport) +#endif + void func_c(); + +int main() +{ + func_c(); + + return 0; +} diff --git a/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.cxx b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.cxx new file mode 100644 index 0000000..ffaa3b4 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries-LINK_LANG_AND_ID/main.cxx @@ -0,0 +1,12 @@ + +#if defined(_WIN32) +__declspec(dllimport) +#endif + void func_cxx(); + +int main() +{ + func_cxx(); + + return 0; +} diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 1f4077c..189592d 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -30,71 +30,3 @@ run_cmake(StaticPrivateDepNotExported) run_cmake(StaticPrivateDepNotTarget) run_cmake(UNKNOWN-IMPORTED-GLOBAL) run_cmake(empty_keyword_args) - -macro(run_cmake_target test subtest target) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) - set(RunCMake_TEST_NO_CLEAN 1) - run_cmake_command(${test}-${subtest} ${CMAKE_COMMAND} --build . --target ${target} ${ARGN}) - - unset(RunCMake_TEST_BINARY_DIR) - unset(RunCMake_TEST_NO_CLEAN) -endmacro() - -set(RunCMake_TEST_OUTPUT_MERGE TRUE) -if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) -endif() -run_cmake(AliasTargets) -run_cmake_target(AliasTargets func func --config Release) -run_cmake_target(AliasTargets lib-local lib-local --config Release) -run_cmake_target(AliasTargets main-local main-local --config Release) -run_cmake_target(AliasTargets lib-global lib-global --config Release) -run_cmake_target(AliasTargets main-global main-global --config Release) -unset(RunCMake_TEST_OPTIONS) -unset(RunCMake_TEST_OUTPUT_MERGE) - -run_cmake(genex_LINK_LANGUAGE-bad-usage) - -if (RunCMake_GENERATOR MATCHES "Makefiles|Ninja|Visual Studio|Xcode|Watcom WMake") - - run_cmake(genex_LINK_LANGUAGE-bad-mix-lang) - run_cmake(genex_LINK_LANG_AND_ID-bad-mix-lang) - - set(RunCMake_TEST_OUTPUT_MERGE TRUE) - if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) - set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) - endif() - - run_cmake(genex_LINK_LANGUAGE) - - run_cmake_target(genex_LINK_LANGUAGE lib LinkLibraries_lib --config Release) - run_cmake_target(genex_LINK_LANGUAGE lib2 LinkLibraries_lib2 --config Release) - run_cmake_target(genex_LINK_LANGUAGE lib3 LinkLibraries_lib3 --config Release) - run_cmake_target(genex_LINK_LANGUAGE exe LinkLibraries_exe --config Release) - run_cmake_target(genex_LINK_LANGUAGE C_import LinkLibraries_C_import --config Release) - run_cmake_target(genex_LINK_LANGUAGE CXX_import LinkLibraries_CXX_import --config Release) - run_cmake_target(genex_LINK_LANGUAGE C_interface LinkLibraries_C_interface --config Release) - run_cmake_target(genex_LINK_LANGUAGE CXX_interface LinkLibraries_CXX_interface --config Release) - run_cmake_target(genex_LINK_LANGUAGE C_interface2 LinkLibraries_C_interface2 --config Release) - run_cmake_target(genex_LINK_LANGUAGE CXX_interface2 LinkLibraries_CXX_interface2 --config Release) - run_cmake_target(genex_LINK_LANGUAGE C_static LinkLibraries_C_static --config Release) - run_cmake_target(genex_LINK_LANGUAGE CXX_static LinkLibraries_CXX_static --config Release) - - run_cmake(genex_LINK_LANG_AND_ID) - - run_cmake_target(genex_LINK_LANG_AND_ID lib LinkLibraries_lib --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID lib2 LinkLibraries_lib2 --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID lib3 LinkLibraries_lib3 --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID exe LinkLibraries_exe --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID C_import LinkLibraries_C_import --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID CXX_import LinkLibraries_CXX_import --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID C_interface LinkLibraries_C_interface --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID CXX_interface LinkLibraries_CXX_interface --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID C_interface2 LinkLibraries_C_interface2 --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID CXX_interface2 LinkLibraries_CXX_interface2 --config Release) - run_cmake_target(genex_LINK_LANG_AND_ID CXX_static LinkLibraries_CXX_static --config Release) - - unset(RunCMake_TEST_OPTIONS) - unset(RunCMake_TEST_OUTPUT_MERGE) - -endif() |