mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 16:36:11 +00:00
4c941247b4
* Move cmake files to the cmake folder. * Rename msc.cmake to msvc.cmake and toolchain-mingw32.cmake to toolchain-gcc.cmake. * Add compilerflags.cmake to group macros that handle different compiler flags. * Move add_linkerflag and set_unicode macros to compilerflags.cmake. They were duplicated in gcc.cmake and msvc.cmake. * Add add_compiler_flags macro to handle CMAKE_C_FLAGS and CMAKE_CXX_FLAGS properly, and replace add_definitions calls with add_compiler_flags calls when we're adding compiler flags, not definitions. * Reorganize gcc.cmake to have compiler flags then linking and compiling rules. * Move CMAKE_ASM_COMPILE_OBJECT out of toolchain-gcc.cmake into gcc.cmake and add ${CMAKE_C_FLAGS} to it, now that flags are properly set. * Don't pass <FLAGS> (compiler flags) when linking. * Without the (commented out) linker script flag, CMAKE_SHARED_LINKER_FLAGS_INIT is the same for both i386 and amd64. Deduplicate it. * Fix CMAKE_C_STANDARD_LIBRARIES comment. * Use <FLAGS> in msvc CMAKE_ASM_COMPILE_OBJECT instead of manual includes. * Don't set ntdllsys linker language to C, it's an asm lib. * Remove ros_cd.cmake as it's not needed anymore. * Define _CRT_SECURE_NO_WARNINGS when compiling host tools with msvc. svn path=/trunk/; revision=52210
51 lines
1.7 KiB
CMake
51 lines
1.7 KiB
CMake
|
|
if(NOT ARCH)
|
|
set(ARCH i386)
|
|
endif()
|
|
|
|
# Choose the right MinGW prefix
|
|
if(ARCH MATCHES i386)
|
|
|
|
if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
|
set(MINGW_PREFIX "" CACHE STRING "MinGW Prefix")
|
|
else()
|
|
set(MINGW_PREFIX "mingw32-" CACHE STRING "MinGW Prefix")
|
|
endif(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
|
|
|
elseif(ARCH MATCHES amd64)
|
|
set(MINGW_PREFIX "x86_64-w64-mingw32-" CACHE STRING "MinGW Prefix")
|
|
elseif(ARCH MATCHES arm)
|
|
set(MINGW_PREFIX "arm-mingw32ce-" CACHE STRING "MinGW Prefix")
|
|
endif()
|
|
|
|
if(ENABLE_CCACHE)
|
|
set(CCACHE "ccache" CACHE STRING "ccache")
|
|
else()
|
|
set(CCACHE "" CACHE STRING "ccache")
|
|
endif()
|
|
|
|
# The name of the target operating system
|
|
set(CMAKE_SYSTEM_NAME Windows)
|
|
set(CMAKE_SYSTEM_PROCESSOR i686)
|
|
|
|
# Which compilers to use for C and C++
|
|
set(CMAKE_C_COMPILER ${CCACHE} ${MINGW_PREFIX}gcc)
|
|
set(CMAKE_CXX_COMPILER ${CCACHE} ${MINGW_PREFIX}g++)
|
|
set(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres)
|
|
set(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc)
|
|
|
|
if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
|
set(CMAKE_AR ${MINGW_PREFIX}ar)
|
|
set(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_AR} crs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
|
set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})
|
|
endif()
|
|
|
|
# Don't link with anything by default unless we say so
|
|
set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
|
|
|
|
#MARK_AS_ADVANCED(CLEAR CMAKE_CXX_STANDARD_LIBRARIES)
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "Standard C++ Libraries")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import")
|