mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 03:29:47 +00:00
parent
548e9051a4
commit
45b4b4b930
@ -4,3 +4,6 @@ vs-vctargetspath
|
||||
* With :ref:`Visual Studio Generators` for VS 2010 and above,
|
||||
the :variable:`CMAKE_GENERATOR_TOOLSET` setting gained an option
|
||||
to specify the ``VCTargetsPath`` value for project files.
|
||||
|
||||
* The :variable:`CMAKE_VS_GLOBALS` variable value now applies during
|
||||
compiler identification.
|
||||
|
@ -320,6 +320,12 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR)
|
||||
set(id_ToolsetVCTargetsDir "<VCTargetsPath>${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}</VCTargetsPath>")
|
||||
endif()
|
||||
set(id_CustomGlobals "")
|
||||
foreach(pair IN LISTS CMAKE_VS_GLOBALS)
|
||||
if("${pair}" MATCHES "([^=]+)=(.*)$")
|
||||
string(APPEND id_CustomGlobals "<${CMAKE_MATCH_1}>${CMAKE_MATCH_2}</${CMAKE_MATCH_1}>\n ")
|
||||
endif()
|
||||
endforeach()
|
||||
if(id_platform STREQUAL ARM64)
|
||||
set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>")
|
||||
elseif(id_platform STREQUAL ARM)
|
||||
|
@ -16,6 +16,7 @@
|
||||
@id_WindowsSDKDesktopARMSupport@
|
||||
@id_CudaToolkitCustomDir@
|
||||
@id_ToolsetVCTargetsDir@
|
||||
@id_CustomGlobals@
|
||||
</PropertyGroup>
|
||||
@id_toolset_version_props@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
|
@ -1,44 +1,65 @@
|
||||
set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
|
||||
if(NOT EXISTS "${vcProjectFile}")
|
||||
set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(InsideGlobals FALSE)
|
||||
set(DefaultLanguageSet FALSE)
|
||||
set(MinimumVisualStudioVersionSet FALSE)
|
||||
|
||||
file(STRINGS "${vcProjectFile}" lines)
|
||||
foreach(line IN LISTS lines)
|
||||
if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$")
|
||||
set(InsideGlobals TRUE)
|
||||
elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> *$")
|
||||
if("${CMAKE_MATCH_1}" STREQUAL "en-US")
|
||||
if(InsideGlobals)
|
||||
message(STATUS "foo.vcxproj has correct DefaultLanguage global property")
|
||||
set(DefaultLanguageSet TRUE)
|
||||
else()
|
||||
message(STATUS "DefaultLanguage is set but not within \"Globals\" property group")
|
||||
endif()
|
||||
endif()
|
||||
elseif(line MATCHES "^ *<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$")
|
||||
if("${CMAKE_MATCH_1}" STREQUAL "14.0")
|
||||
if(InsideGlobals)
|
||||
message(STATUS "foo.vcxproj has correct MinimumVisualStudioVersion global property")
|
||||
set(MinimumVisualStudioVersionSet TRUE)
|
||||
else()
|
||||
message(STATUS "MinimumVisualStudioVersion is set but not within \"Globals\" property group")
|
||||
endif()
|
||||
endif()
|
||||
macro(check_project_file projectFile)
|
||||
if(NOT EXISTS "${projectFile}")
|
||||
set(RunCMake_TEST_FAILED "Project file ${projectFile} does not exist.")
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT DefaultLanguageSet)
|
||||
set(RunCMake_TEST_FAILED "DefaultLanguageSet not found or not set correctly.")
|
||||
return()
|
||||
endif()
|
||||
string(REPLACE "${RunCMake_TEST_BINARY_DIR}/" "" projectName ${projectFile})
|
||||
|
||||
if(NOT MinimumVisualStudioVersionSet)
|
||||
set(RunCMake_TEST_FAILED "MinimumVisualStudioVersionSet not found or not set correctly.")
|
||||
return()
|
||||
endif()
|
||||
set(InsideGlobals FALSE)
|
||||
set(DefaultLanguageSet FALSE)
|
||||
set(MinimumVisualStudioVersionSet FALSE)
|
||||
set(TestPropertySet FALSE)
|
||||
|
||||
file(STRINGS "${projectFile}" lines)
|
||||
foreach(line IN LISTS lines)
|
||||
if(line MATCHES "^ *<PropertyGroup Label=\"Globals\"> *$")
|
||||
set(InsideGlobals TRUE)
|
||||
elseif(line MATCHES "^ *<DefaultLanguage>([a-zA-Z\\-]+)</DefaultLanguage> *$")
|
||||
if("${CMAKE_MATCH_1}" STREQUAL "en-US")
|
||||
if(InsideGlobals)
|
||||
message(STATUS "${projectName} has correct DefaultLanguage global property")
|
||||
set(DefaultLanguageSet TRUE)
|
||||
else()
|
||||
message(STATUS "DefaultLanguage is set but not within \"Globals\" property group")
|
||||
endif()
|
||||
endif()
|
||||
elseif(line MATCHES "^ *<MinimumVisualStudioVersion>([0-9\\.]+)</MinimumVisualStudioVersion> *$")
|
||||
if("${CMAKE_MATCH_1}" STREQUAL "10.0")
|
||||
if(InsideGlobals)
|
||||
message(STATUS "${projectName} has correct MinimumVisualStudioVersion global property")
|
||||
set(MinimumVisualStudioVersionSet TRUE)
|
||||
else()
|
||||
message(STATUS "MinimumVisualStudioVersion is set but not within \"Globals\" property group")
|
||||
endif()
|
||||
endif()
|
||||
elseif(line MATCHES "^ *<TestProperty>(.+)</TestProperty> *$")
|
||||
if("${CMAKE_MATCH_1}" STREQUAL "TestValue")
|
||||
if(InsideGlobals)
|
||||
message(STATUS "${projectName} has correct TestProperty global property")
|
||||
set(TestPropertySet TRUE)
|
||||
else()
|
||||
message(STATUS "TestProperty is set but not within \"Globals\" property group")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT DefaultLanguageSet)
|
||||
set(RunCMake_TEST_FAILED "DefaultLanguage not found or not set correctly in ${projectName}.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT MinimumVisualStudioVersionSet)
|
||||
set(RunCMake_TEST_FAILED "MinimumVisualStudioVersion not found or not set correctly in ${projectName}.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT TestPropertySet)
|
||||
set(RunCMake_TEST_FAILED "TestProperty not found or not set correctly in ${projectName}.")
|
||||
return()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
check_project_file("${RunCMake_TEST_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CompilerIdCXX/CompilerIdCXX.vcxproj")
|
||||
check_project_file("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
|
||||
|
@ -1,8 +1,9 @@
|
||||
enable_language(CXX)
|
||||
|
||||
set(CMAKE_VS_GLOBALS
|
||||
"DefaultLanguage=en-US"
|
||||
"MinimumVisualStudioVersion=14.0"
|
||||
"MinimumVisualStudioVersion=10.0"
|
||||
"TestProperty=TestValue"
|
||||
)
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
add_library(foo foo.cpp)
|
||||
|
Loading…
Reference in New Issue
Block a user