mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 03:23:34 +08:00
[CMAKE] Search the PATH for the compilers and cache the results
We are deliberately using a macro here instead of REQUIRED parameter because it is available only in CMake 3.18+, so it won't work with CMake version that is being shipped with RosBE. On my dev box the RosBE tools are only in the PATH when needed. Since my IDE inherits the PATH from the system and not from my shell, I needed to be able to run configure.sh with the tools in my PATH and then be able to successfully reconfigure when building from a "regular" command prompt.
This commit is contained in:
parent
6c38b251cf
commit
3464df8c28
@ -1,4 +1,11 @@
|
|||||||
|
|
||||||
|
macro(require_program varname execname)
|
||||||
|
find_program(${varname} ${execname})
|
||||||
|
if(NOT ${varname})
|
||||||
|
message(FATAL_ERROR "${execname} not found")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
# pass variables necessary for the toolchain (needed for try_compile)
|
# pass variables necessary for the toolchain (needed for try_compile)
|
||||||
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH)
|
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES ARCH)
|
||||||
|
|
||||||
@ -28,15 +35,15 @@ set(CMAKE_SYSTEM_NAME Windows)
|
|||||||
set(CMAKE_SYSTEM_PROCESSOR i686)
|
set(CMAKE_SYSTEM_PROCESSOR i686)
|
||||||
|
|
||||||
# Which tools to use
|
# Which tools to use
|
||||||
set(CMAKE_C_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX} CACHE FILEPATH "The C Compiler")
|
require_program(CMAKE_C_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
|
||||||
set(CMAKE_CXX_COMPILER ${MINGW_TOOLCHAIN_PREFIX}g++${MINGW_TOOLCHAIN_SUFFIX} CACHE FILEPATH "The C++ Compiler")
|
require_program(CMAKE_CXX_COMPILER ${MINGW_TOOLCHAIN_PREFIX}g++${MINGW_TOOLCHAIN_SUFFIX})
|
||||||
set(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX} CACHE FILEPATH "The ASM Compiler")
|
require_program(CMAKE_ASM_COMPILER ${MINGW_TOOLCHAIN_PREFIX}gcc${MINGW_TOOLCHAIN_SUFFIX})
|
||||||
set(CMAKE_ASM_COMPILER_ID "GNU")
|
set(CMAKE_ASM_COMPILER_ID "GNU")
|
||||||
set(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc)
|
require_program(CMAKE_MC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windmc)
|
||||||
set(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres)
|
require_program(CMAKE_RC_COMPILER ${MINGW_TOOLCHAIN_PREFIX}windres)
|
||||||
set(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool)
|
require_program(CMAKE_DLLTOOL ${MINGW_TOOLCHAIN_PREFIX}dlltool)
|
||||||
#set(CMAKE_AR ${MINGW_TOOLCHAIN_PREFIX}gcc-ar${MINGW_TOOLCHAIN_SUFFIX})
|
#set(CMAKE_AR ${MINGW_TOOLCHAIN_PREFIX}gcc-ar${MINGW_TOOLCHAIN_SUFFIX})
|
||||||
set(CMAKE_OBJCOPY ${MINGW_TOOLCHAIN_PREFIX}objcopy)
|
require_program(CMAKE_OBJCOPY ${MINGW_TOOLCHAIN_PREFIX}objcopy)
|
||||||
|
|
||||||
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
|
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||||
set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
||||||
|
Loading…
Reference in New Issue
Block a user