source_properties.cmake 1.1 KB

12345678910111213141516171819202122232425
  1. function (check_source_file_property file prop)
  2. get_source_file_property(gsfp_val "${file}" "${prop}")
  3. get_property(gp_val
  4. SOURCE "${file}"
  5. PROPERTY "${prop}")
  6. message("get_source_file_property: -->${gsfp_val}<--")
  7. message("get_property: -->${gp_val}<--")
  8. endfunction ()
  9. set_source_files_properties(file.c PROPERTIES empty "" custom value)
  10. check_source_file_property(file.c empty)
  11. check_source_file_property(file.c custom)
  12. check_source_file_property(file.c noexist)
  13. # Test strange legacy behavior in which the order in which source files are
  14. # first accessed affects how properties are applied without an extension.
  15. # See also issue #15208.
  16. get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.c PROPERTY LANGUAGE)
  17. get_property(lang SOURCE ${CMAKE_CURRENT_BINARY_DIR}/file2.h PROPERTY LANGUAGE)
  18. set_property(SOURCE file2 PROPERTY custom value) # set property without extension
  19. check_source_file_property(file2 custom) # should have property
  20. check_source_file_property(file2.h custom) # should not have property
  21. check_source_file_property(file2.c custom) # should have property