summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/VS10Project/VsNoCompileBatching-check.cmake
blob: 4002c3fc3bf0b074a00b5263a65632ebb41e1570 (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
26
27
28
29
30
31
macro(VsNoCompileBatching_check tgt ofn_expect)
  set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj")
  if(NOT EXISTS "${vcProjectFile}")
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.")
    return()
  endif()

  set(HAVE_OFN 0)

  file(STRINGS "${vcProjectFile}" lines)
  foreach(line IN LISTS lines)
    if(line MATCHES "^ *<ObjectFileName>([^<>]+)</ObjectFileName>")
      set(ofn_actual "${CMAKE_MATCH_1}")
      if(NOT "${ofn_actual}" STREQUAL "${ofn_expect}")
        set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has <ObjectFileName> '${ofn_actual}', not '${ofn_expect}'.")
        return()
      endif()
      set(HAVE_OFN 1)
      break()
    endif()
  endforeach()

  if(NOT HAVE_OFN)
    set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a <ObjectFileName> property.")
    return()
  endif()
endmacro()

VsNoCompileBatching_check(foo "$(IntDir)")
VsNoCompileBatching_check(foo_NB "$(IntDir)%(filename).obj")
VsNoCompileBatching_check(foo_NB_OFF "$(IntDir)")