summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
blob: 22a3df0f0cb7f8ca41a6ab3a1de04061e4b3ab12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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(importFound FALSE)

set(props_file "${RunCMake_SOURCE_DIR}/my.props")
file(TO_NATIVE_PATH "${props_file}" check_file)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
  if(line MATCHES "^ *<Import Project=\"([^\"]+)\".*Label=\"([^\"]+)\".*$")
    if("${CMAKE_MATCH_1}" STREQUAL "${check_file}" AND
       "${CMAKE_MATCH_2}" STREQUAL "LocalAppDataPlatform")
        message(STATUS "foo.vcxproj is importing ${check_file}")
        set(importFound TRUE)
    endif()
  endif()
endforeach()

if(NOT importFound)
  set(RunCMake_TEST_FAILED "Import of custom .props file not found.")
  return()
endif()