mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-16 20:21:41 -06:00
Genex: Enable COMPILE_LANGUAGE for file(GENERATE) with Visual Studio
Issue: #17435
This commit is contained in:
@@ -828,12 +828,16 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
|
||||
}
|
||||
std::string genName = gg->GetName();
|
||||
if (genName.find("Visual Studio") != std::string::npos) {
|
||||
reportError(context, content->GetOriginalExpression(),
|
||||
"$<COMPILE_LANGUAGE:...> may not be used with Visual Studio "
|
||||
"generators.");
|
||||
return std::string();
|
||||
}
|
||||
if (genName.find("Xcode") != std::string::npos) {
|
||||
if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() ||
|
||||
dagChecker->EvaluatingCompileOptions() ||
|
||||
dagChecker->EvaluatingIncludeDirectories())) {
|
||||
reportError(
|
||||
context, content->GetOriginalExpression(),
|
||||
"$<COMPILE_LANGUAGE:...> may only be used for file(GENERATE) "
|
||||
"with the Visual Studio generator.");
|
||||
return std::string();
|
||||
}
|
||||
} else if (genName.find("Xcode") != std::string::npos) {
|
||||
if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() ||
|
||||
dagChecker->EvaluatingIncludeDirectories())) {
|
||||
reportError(
|
||||
|
||||
@@ -3,6 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\):
|
||||
|
||||
\$<COMPILE_LANGUAGE:CXX>
|
||||
|
||||
\$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.
|
||||
\$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
|
||||
Studio generator.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
|
||||
@@ -3,6 +3,7 @@ CMake Error at CompileOptions.cmake:5 \(target_compile_options\):
|
||||
|
||||
\$<COMPILE_LANGUAGE:CXX>
|
||||
|
||||
\$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.
|
||||
\$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
|
||||
Studio generator.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
|
||||
@@ -3,6 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\):
|
||||
|
||||
\$<COMPILE_LANGUAGE:CXX>
|
||||
|
||||
\$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.
|
||||
\$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
|
||||
Studio generator.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
|
||||
@@ -21,15 +21,13 @@ if (NOT file_contents MATCHES "generated.cpp.rule")
|
||||
message(SEND_ERROR "Rule file not in target sources! ${file_contents}")
|
||||
endif()
|
||||
|
||||
if (NOT RunCMake_GENERATOR MATCHES "Visual Studio")
|
||||
run_cmake(COMPILE_LANGUAGE-genex)
|
||||
foreach(l CXX C)
|
||||
file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs)
|
||||
if (NOT l_defs STREQUAL "LANG_IS_${l}\n")
|
||||
message(FATAL_ERROR "File content does not match: ${l_defs}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
run_cmake(COMPILE_LANGUAGE-genex)
|
||||
foreach(l CXX C)
|
||||
file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs)
|
||||
if (NOT l_defs STREQUAL "LANG_IS_${l}\n")
|
||||
message(FATAL_ERROR "File content does not match: ${l_defs}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(timeformat "%Y%j%H%M%S")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user