diff options
author | Brad King <brad.king@kitware.com> | 2019-10-18 13:01:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-10-18 13:01:48 (GMT) |
commit | b34b4c5eac27bfc4a1e46f2b46ba17f5be6a8565 (patch) | |
tree | cca98eb61f39604776d35cf96dc78872246a8f8b /Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake | |
parent | c867981c9d9bc8548d34f726940cd50b8d05d71c (diff) | |
parent | e7d57bc3c35e7c47746caf91591ef748b9ce3012 (diff) | |
download | CMake-b34b4c5eac27bfc4a1e46f2b46ba17f5be6a8565.zip CMake-b34b4c5eac27bfc4a1e46f2b46ba17f5be6a8565.tar.gz CMake-b34b4c5eac27bfc4a1e46f2b46ba17f5be6a8565.tar.bz2 |
Merge topic 'vs-vctargetspath'
e7d57bc3c3 VS: Propagate CMAKE_VS_GLOBALS into custom targets
45b4b4b930 VS: Propagate CMAKE_VS_GLOBALS into compiler id projects
548e9051a4 VS: Add support to override VCTargetsPath through toolset
99e83d4235 cmake: Teach --build mode to load CMAKE_GENERATOR_TOOLSET
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3817
Diffstat (limited to 'Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake')
-rw-r--r-- | Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake b/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake new file mode 100644 index 0000000..5b1701c --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsVCTargetsPath-check.cmake @@ -0,0 +1,32 @@ +macro(check_project_file projectFile) + set(insideGlobals FALSE) + set(pathFound FALSE) + + if(NOT EXISTS "${projectFile}") + set(RunCMake_TEST_FAILED "Project file ${projectFile} does not exist.") + return() + endif() + + string(REPLACE "${RunCMake_TEST_BINARY_DIR}/" "" projectName ${projectFile}) + + file(STRINGS "${projectFile}" lines) + foreach(line IN LISTS lines) + if(line MATCHES "^ *<PropertyGroup Label=\"Globals\">.*$") + set(insideGlobals TRUE) + elseif(insideGlobals) + if(line MATCHES "^ *</PropertyGroup>.*$") + set(insideGlobals FALSE) + elseif(line MATCHES "^ *<VCTargetsPath>(.+)</VCTargetsPath>*$") + message(STATUS "Found VCTargetsPath = ${CMAKE_MATCH_1} in PropertyGroup 'Globals' in ${projectName}") + set(pathFound TRUE) + endif() + endif() + endforeach() + if(NOT pathFound) + set(RunCMake_TEST_FAILED "VCTargetsPath not found in \"Globals\" propertygroup in ${projectName}") + return() # This should intentionally return from the caller, not the macro + endif() +endmacro() + +check_project_file("${RunCMake_TEST_BINARY_DIR}/CMakeFiles/${CMAKE_VERSION}/CompilerIdCXX/CompilerIdCXX.vcxproj") +check_project_file("${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") |