summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CXXModules/NinjaDependInfoBMIInstall-check.cmake
blob: 6de2e1eafc7e551f48d66f5e9c03a2611f2a5428 (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
32
33
34
35
36
37
38
39
include("${CMAKE_CURRENT_LIST_DIR}/check-json.cmake")

if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
  set(have_file 0)
  foreach (CXXModules_config IN ITEMS Release Debug RelWithDebInfo MinSizeRel)
    if (NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${CXXModules_config}/CXXDependInfo.json")
      continue ()
    endif ()
    set(have_file 1)

    set(CMAKE_BUILD_TYPE "${CXXModules_config}")

    file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents)
    file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents)
    check_json("${actual_contents}" "${expect_contents}")

    file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/${CXXModules_config}/CXXDependInfo.json" actual_contents)
    file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents)
    check_json("${actual_contents}" "${expect_contents}")
  endforeach ()

  if (NOT have_file)
    list(APPEND RunCMake_TEST_FAILED
      "No recognized build configurations found.")
  endif ()
else ()
  set(CXXModules_config "${CXXModules_default_build_type}")
  set(CMAKE_BUILD_TYPE "${CXXModules_default_build_type}")

  file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-public.dir/CXXDependInfo.json" actual_contents)
  file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-public.json" expect_contents)
  check_json("${actual_contents}" "${expect_contents}")

  file(READ "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/ninja-bmi-install-private.dir/CXXDependInfo.json" actual_contents)
  file(READ "${CMAKE_CURRENT_LIST_DIR}/expect/NinjaDependInfoBMIInstall-private.json" expect_contents)
  check_json("${actual_contents}" "${expect_contents}")
endif ()

string(REPLACE ";" "\n  " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")