CMakeRCInformation.cmake 1.46 KB
Newer Older
1 2
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
3 4


5
# This file sets the basic flags for the Windows Resource Compiler.
6 7 8
# It also loads the available platform file for the system-compiler
# if it exists.

9
# make sure we don't use CMAKE_BASE_NAME from somewhere else
10
set(CMAKE_BASE_NAME)
11 12 13 14
if(CMAKE_RC_COMPILER MATCHES "windres[^/]*$")
 set(CMAKE_BASE_NAME "windres")
else()
 get_filename_component(CMAKE_BASE_NAME ${CMAKE_RC_COMPILER} NAME_WE)
15 16
endif()
set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE
17
  ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
18
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
19

20 21
set(CMAKE_RC_FLAGS_INIT "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}")

22
cmake_initialize_per_config_variable(CMAKE_RC_FLAGS "Flags for Windows Resource Compiler")
23

24 25 26
# These are the only types of flags that should be passed to the rc
# command, if COMPILE_FLAGS is used on a target this will be used
# to filter out any other flags
27
set(CMAKE_RC_FLAG_REGEX "^[-/](D|I)")
28 29 30

# now define the following rule variables
# CMAKE_RC_COMPILE_OBJECT
31
set(CMAKE_INCLUDE_FLAG_RC "-I")
32
# compile a Resource file into an object file
33 34
if(NOT CMAKE_RC_COMPILE_OBJECT)
  set(CMAKE_RC_COMPILE_OBJECT
35
    "<CMAKE_RC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /fo <OBJECT> <SOURCE>")
36
endif()
37 38

# set this variable so we can avoid loading this more than once.
39
set(CMAKE_RC_INFORMATION_LOADED 1)