CMakeRCInformation.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. # This should be included before the _INIT variables are
  17. # used to initialize the cache. Since the rule variables
  18. # have if blocks on them, users can still define them here.
  19. # But, it should still be after the platform file so changes can
  20. # be made to those values.
  21. if(CMAKE_USER_MAKE_RULES_OVERRIDE)
  22. # Save the full path of the file so try_compile can use it.
  23. include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
  24. set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
  25. endif()
  26. set(CMAKE_RC_FLAGS_INIT "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}")
  27. cmake_initialize_per_config_variable(CMAKE_RC_FLAGS "Flags for Windows Resource Compiler")
  28. # These are the only types of flags that should be passed to the rc
  29. # command, if COMPILE_FLAGS is used on a target this will be used
  30. # to filter out any other flags
  31. set(CMAKE_RC_FLAG_REGEX "^[-/](D|I)")
  32. # now define the following rule variables
  33. # CMAKE_RC_COMPILE_OBJECT
  34. set(CMAKE_INCLUDE_FLAG_RC "-I")
  35. # compile a Resource file into an object file
  36. if(NOT CMAKE_RC_COMPILE_OBJECT)
  37. set(CMAKE_RC_COMPILE_OBJECT
  38. "<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo <OBJECT> <SOURCE>")
  39. endif()
  40. # set this variable so we can avoid loading this more than once.
  41. set(CMAKE_RC_INFORMATION_LOADED 1)