1 if(CMAKE_VERSION VERSION_LESS 3.19.0) |
1 set(configure_cmake_args) |
2 return() |
|
3 endif() |
|
4 |
|
5 if(CMAKE_C_COMPILER) |
2 if(CMAKE_C_COMPILER) |
6 set(TEST_C_COMPILER "C_COMPILER" "${CMAKE_C_COMPILER}") |
3 list(APPEND configure_cmake_args "C_COMPILER" "${CMAKE_C_COMPILER}") |
7 endif() |
4 endif() |
8 if(CMAKE_CXX_COMPILER) |
5 if(CMAKE_CXX_COMPILER) |
9 set(TEST_CXX_COMPILER "CXX_COMPILER" "${CMAKE_CXX_COMPILER}") |
6 list(APPEND configure_cmake_args "CXX_COMPILER" "${CMAKE_CXX_COMPILER}") |
|
7 endif() |
|
8 if(CMAKE_C_COMPILER_TARGET) |
|
9 list(APPEND configure_cmake_args "C_COMPILER_TARGET" "${CMAKE_C_COMPILER_TARGET}") |
|
10 endif() |
|
11 if(CMAKE_CXX_COMPILER_TARGET) |
|
12 list(APPEND configure_cmake_args "CXX_COMPILER_TARGET" "${CMAKE_CXX_COMPILER_TARGET}") |
10 endif() |
13 endif() |
11 if(CMAKE_GENERATOR_PLATFORM) |
14 if(CMAKE_GENERATOR_PLATFORM) |
12 set(TEST_GENERATOR_PLATFORM "GENERATOR_PLATFORM" "${CMAKE_GENERATOR_PLATFORM}") |
15 list(APPEND configure_cmake_args "GENERATOR_PLATFORM" "${CMAKE_GENERATOR_PLATFORM}") |
|
16 endif() |
|
17 if(CMAKE_OSX_ARCHITECTURES) |
|
18 list(APPEND configure_cmake_args OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") |
|
19 endif() |
|
20 if(CMAKE_TOOLCHAIN_FILE) |
|
21 list(APPEND configure_cmake_args TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}") |
13 endif() |
22 endif() |
14 |
23 |
15 add_test(NAME "output_directory_build" |
24 add_test(NAME "output_directory_build" |
16 COMMAND |
25 COMMAND |
17 ${CMAKE_COMMAND} |
26 ${CMAKE_COMMAND} |
20 BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/build" |
29 BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/build" |
21 GENERATOR "${CMAKE_GENERATOR}" |
30 GENERATOR "${CMAKE_GENERATOR}" |
22 RUST_TOOLCHAIN "${Rust_TOOLCHAIN}" |
31 RUST_TOOLCHAIN "${Rust_TOOLCHAIN}" |
23 CARGO_TARGET "${Rust_CARGO_TARGET}" |
32 CARGO_TARGET "${Rust_CARGO_TARGET}" |
24 SYSTEM_NAME "${CMAKE_SYSTEM_NAME}" |
33 SYSTEM_NAME "${CMAKE_SYSTEM_NAME}" |
25 "${TEST_C_COMPILER}" |
34 ${configure_cmake_args} |
26 "${TEST_CXX_COMPILER}" |
|
27 "${TEST_GENERATOR_PLATFORM}" |
|
28 |
35 |
29 COMMAND_EXPAND_LISTS |
36 COMMAND_EXPAND_LISTS |
30 ) |
37 ) |
31 set_tests_properties("output_directory_build" PROPERTIES FIXTURES_SETUP "build_fixture_output_directory") |
38 set_tests_properties("output_directory_build" PROPERTIES FIXTURES_SETUP "build_fixture_output_directory") |
32 if(CORROSION_TESTS_INSTALL_CORROSION) |
39 if(CORROSION_TESTS_INSTALL_CORROSION) |
33 set_tests_properties("output_directory_build" PROPERTIES FIXTURES_REQUIRED "fixture_corrosion_install") |
40 set_tests_properties("output_directory_build" PROPERTIES FIXTURES_REQUIRED "fixture_corrosion_install") |
34 endif() |
41 endif() |
35 |
42 |
36 foreach(output_approach targetprop var) |
43 foreach(output_approach targetprop var targetprop_pdb_fallback) |
37 if(output_approach STREQUAL "targetprop") |
44 if(output_approach STREQUAL "targetprop") |
38 set(rust_proj_suffix "1") |
45 set(rust_proj_suffix "1") |
39 elseif(output_approach STREQUAL "var") |
46 elseif(output_approach STREQUAL "var") |
40 set(rust_proj_suffix "2") |
47 set(rust_proj_suffix "2") |
|
48 elseif(output_approach STREQUAL "targetprop_pdb_fallback") |
|
49 set(rust_proj_suffix "3") |
41 else() |
50 else() |
42 message(FATAL_ERROR "specify rust project suffix for new output approach ${output_approach}") |
51 message(FATAL_ERROR "specify rust project suffix for new output approach ${output_approach}") |
43 endif() |
52 endif() |
44 |
53 |
45 set(bin_name "rust_bin${rust_proj_suffix}${CMAKE_EXECUTABLE_SUFFIX}") |
54 set(bin_name "rust_bin${rust_proj_suffix}${CMAKE_EXECUTABLE_SUFFIX}") |
100 elseif(output_approach STREQUAL "var") |
109 elseif(output_approach STREQUAL "var") |
101 # When using a CMAKE_ variable instead of a target property, both targets |
110 # When using a CMAKE_ variable instead of a target property, both targets |
102 # end up in the same directory. |
111 # end up in the same directory. |
103 set(expected_lib_pdb_path "custom_binlib_pdb_var") |
112 set(expected_lib_pdb_path "custom_binlib_pdb_var") |
104 set(expected_bin_pdb_path "custom_binlib_pdb_var") |
113 set(expected_bin_pdb_path "custom_binlib_pdb_var") |
|
114 elseif(output_approach STREQUAL "targetprop_pdb_fallback") |
|
115 set(expected_lib_pdb_path "custom_lib_targetprop_pdb_fallback") |
|
116 set(expected_bin_pdb_path "custom_bin_targetprop_pdb_fallback") |
105 else() |
117 else() |
106 message(FATAL_ERROR "specify rust project suffix for new output approach ${output_approach}") |
118 message(FATAL_ERROR "specify rust project suffix for new output approach ${output_approach}") |
107 endif() |
119 endif() |
108 |
120 |
109 set(lib_pdb_name "${lib_name}.pdb") |
121 set(lib_pdb_name "${lib_name}.pdb") |