CMakeRCInformation.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # This file sets the basic flags for the Windows Resource Compiler.
  4. # It also loads the available platform file for the system-compiler
  5. # if it exists.
  6. # make sure we don't use CMAKE_BASE_NAME from somewhere else
  7. set(CMAKE_BASE_NAME)
  8. if(CMAKE_RC_COMPILER MATCHES "windres[^/]*$")
  9. set(CMAKE_BASE_NAME "windres")
  10. else()
  11. get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
  12. endif()
  13. set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE
  14. ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
  15. include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
  16. string(STRIP "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}" CMAKE_RC_FLAGS_INIT)
  17. set (CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS_INIT}" CACHE STRING
  18. "Flags for Windows Resource Compiler.")
  19. # These are the only types of flags that should be passed to the rc
  20. # command, if COMPILE_FLAGS is used on a target this will be used
  21. # to filter out any other flags
  22. set(CMAKE_RC_FLAG_REGEX "^[-/](D|I)")
  23. # now define the following rule variables
  24. # CMAKE_RC_COMPILE_OBJECT
  25. set(CMAKE_INCLUDE_FLAG_RC "-I")
  26. # compile a Resource file into an object file
  27. if(NOT CMAKE_RC_COMPILE_OBJECT)
  28. set(CMAKE_RC_COMPILE_OBJECT
  29. "<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo<OBJECT> <SOURCE>")
  30. endif()
  31. mark_as_advanced(
  32. CMAKE_RC_FLAGS
  33. )
  34. # set this variable so we can avoid loading this more than once.
  35. set(CMAKE_RC_INFORMATION_LOADED 1)