CMakeRCInformation.cmake 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. set(CMAKE_RC_FLAGS_INIT "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}")
  17. foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
  18. string(STRIP "${CMAKE_RC_FLAGS${c}_INIT}" CMAKE_RC_FLAGS${c}_INIT)
  19. endforeach()
  20. set (CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS_INIT}" CACHE STRING
  21. "Flags for Windows Resource Compiler.")
  22. if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
  23. set (CMAKE_RC_FLAGS_DEBUG "${CMAKE_RC_FLAGS_DEBUG_INIT}" CACHE STRING
  24. "Flags for Windows Resource Compiler during debug builds.")
  25. set (CMAKE_RC_FLAGS_MINSIZEREL "${CMAKE_RC_FLAGS_MINSIZEREL_INIT}" CACHE STRING
  26. "Flags for Windows Resource Compiler during release builds for minimum size.")
  27. set (CMAKE_RC_FLAGS_RELEASE "${CMAKE_RC_FLAGS_RELEASE_INIT}" CACHE STRING
  28. "Flags for Windows Resource Compiler during release builds.")
  29. set (CMAKE_RC_FLAGS_RELWITHDEBINFO "${CMAKE_RC_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
  30. "Flags for Windows Resource Compiler during release builds with debug info.")
  31. endif()
  32. # These are the only types of flags that should be passed to the rc
  33. # command, if COMPILE_FLAGS is used on a target this will be used
  34. # to filter out any other flags
  35. set(CMAKE_RC_FLAG_REGEX "^[-/](D|I)")
  36. # now define the following rule variables
  37. # CMAKE_RC_COMPILE_OBJECT
  38. set(CMAKE_INCLUDE_FLAG_RC "-I")
  39. # compile a Resource file into an object file
  40. if(NOT CMAKE_RC_COMPILE_OBJECT)
  41. set(CMAKE_RC_COMPILE_OBJECT
  42. "<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo<OBJECT> <SOURCE>")
  43. endif()
  44. mark_as_advanced(
  45. CMAKE_RC_FLAGS
  46. CMAKE_RC_FLAGS_DEBUG
  47. CMAKE_RC_FLAGS_MINSIZEREL
  48. CMAKE_RC_FLAGS_RELEASE
  49. CMAKE_RC_FLAGS_RELWITHDEBINFO
  50. )
  51. # set this variable so we can avoid loading this more than once.
  52. set(CMAKE_RC_INFORMATION_LOADED 1)