mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 22:30:13 -06:00
Tests/Module/WCDH: write multi_file_compiler_detection.h before using it
This was broken in commit 98e6d1e5e4
(Tests/Module/WCDH: make it work with only C features defined) when all C tests
were made accessible even if no C++ features are available, but the header was
only created if C++ features are available. Fix it by creating the header
unconditionally before any checks on the available features.
This commit is contained in:
@@ -20,6 +20,17 @@ write_compiler_detection_header(
|
||||
${cxx_known_features} ${c_known_features}
|
||||
)
|
||||
|
||||
write_compiler_detection_header(
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/multi_file_compiler_detection.h"
|
||||
PREFIX MULTI
|
||||
OUTPUT_FILES_VAR multi_files
|
||||
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/compiler_support"
|
||||
COMPILERS GNU Clang AppleClang MSVC SunPro Intel
|
||||
VERSION 3.1
|
||||
FEATURES
|
||||
${cxx_known_features} ${c_known_features}
|
||||
)
|
||||
|
||||
macro(set_defines target true_defs false_defs)
|
||||
set(defines)
|
||||
foreach(def ${true_defs})
|
||||
@@ -116,17 +127,6 @@ add_executable(WriteCompilerDetectionHeader main.cpp)
|
||||
set_property(TARGET WriteCompilerDetectionHeader PROPERTY CXX_STANDARD 98)
|
||||
set_defines(WriteCompilerDetectionHeader "${true_defs}" "${false_defs}")
|
||||
|
||||
write_compiler_detection_header(
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/multi_file_compiler_detection.h"
|
||||
PREFIX MULTI
|
||||
OUTPUT_FILES_VAR multi_files
|
||||
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files/compiler_support"
|
||||
COMPILERS GNU Clang AppleClang MSVC SunPro Intel
|
||||
VERSION 3.1
|
||||
FEATURES
|
||||
${cxx_known_features} ${c_known_features}
|
||||
)
|
||||
|
||||
add_executable(multi_files multi_files.cpp)
|
||||
set_property(TARGET multi_files PROPERTY CXX_STANDARD 98)
|
||||
target_include_directories(multi_files PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/compiler_multi_files)
|
||||
|
||||
Reference in New Issue
Block a user