Mercurial > hg > orthanc-webviewer
diff Orthanc/Resources/CMake/Compiler.cmake @ 28:d158e4ca5734
sync with mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Jun 2015 09:54:10 +0200 |
parents | 15acbf5e7545 |
children | 111689a2c177 |
line wrap: on
line diff
--- a/Orthanc/Resources/CMake/Compiler.cmake Tue Jun 02 12:27:59 2015 +0200 +++ b/Orthanc/Resources/CMake/Compiler.cmake Thu Jun 04 09:54:10 2015 +0200 @@ -1,6 +1,12 @@ # This file sets all the compiler-related flags -if (${CMAKE_COMPILER_IS_GNUCXX}) +if (CMAKE_CROSSCOMPILING) + # Cross-compilation necessarily implies standalone and static build + SET(STATIC_BUILD ON) + SET(STANDALONE_BUILD ON) +endif() + +if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long -Wno-implicit-function-declaration") # --std=c99 makes libcurl not to compile # -pedantic gives a lot of warnings on OpenSSL @@ -11,7 +17,7 @@ set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -I<CMAKE_CURRENT_SOURCE_DIR> <SOURCE> <OBJECT>") endif() -elseif (${MSVC}) +elseif (MSVC) # Use static runtime under Visual Studio # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace # http://stackoverflow.com/a/6510446 @@ -53,6 +59,8 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") add_definitions( -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 @@ -67,7 +75,7 @@ ) link_libraries(rpcrt4 ws2_32) - if (${CMAKE_COMPILER_IS_GNUCXX}) + if (CMAKE_COMPILER_IS_GNUCXX) # This is a patch for MinGW64 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") @@ -118,7 +126,7 @@ endif() -if (${STATIC_BUILD}) +if (STATIC_BUILD) add_definitions(-DORTHANC_STATIC=1) else() add_definitions(-DORTHANC_STATIC=0)