PchInterface-check.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
  2. set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/CMakeFiles/foo.dir/cmake_pch.h")
  3. set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h")
  4. else()
  5. set(foo_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h")
  6. set(foobar_pch_header "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h")
  7. endif()
  8. if (NOT EXISTS ${foo_pch_header})
  9. set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} does not exist")
  10. return()
  11. endif()
  12. if (NOT EXISTS ${foobar_pch_header})
  13. set(RunCMake_TEST_FAILED "Generated foobar pch header ${foobar_pch_header} does not exist")
  14. return()
  15. endif()
  16. file(STRINGS ${foo_pch_header} foo_pch_header_strings)
  17. if (NOT "#include \"foo.h\"" IN_LIST foo_pch_header_strings OR
  18. NOT "#include <stdio.h>" IN_LIST foo_pch_header_strings OR
  19. NOT "#include \"string.h\"" IN_LIST foo_pch_header_strings)
  20. set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} has bad content")
  21. return()
  22. endif()
  23. file(STRINGS ${foobar_pch_header} foobar_pch_header_strings)
  24. if (NOT "#include \"foo.h\"" IN_LIST foobar_pch_header_strings OR
  25. NOT "#include <stdio.h>" IN_LIST foobar_pch_header_strings OR
  26. NOT "#include \"string.h\"" IN_LIST foobar_pch_header_strings OR
  27. NOT "#include \"bar.h\"" IN_LIST foobar_pch_header_strings)
  28. set(RunCMake_TEST_FAILED "Generated foobar pch header ${foobar_pch_header} has bad content")
  29. return()
  30. endif()