Mercurial > hg > orthanc
comparison Resources/CMake/Compiler.cmake @ 1337:afaa55d42ddd
FreeBSD support
author | jodogne |
---|---|
date | Tue, 31 Mar 2015 11:40:29 +0200 |
parents | a80e811ec619 |
children | 601d34afdab9 |
comparison
equal
deleted
inserted
replaced
1336:a80e811ec619 | 1337:afaa55d42ddd |
---|---|
39 link_libraries(netapi32) | 39 link_libraries(netapi32) |
40 endif() | 40 endif() |
41 | 41 |
42 | 42 |
43 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR | 43 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR |
44 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") | 44 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR |
45 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") | 45 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") |
46 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include") | |
47 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward -fpermissive") | |
48 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH}") | |
49 endif() | |
50 | |
51 add_definitions( | |
52 -D_LARGEFILE64_SOURCE=1 | |
53 -D_FILE_OFFSET_BITS=64 | |
54 ) | |
55 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") | |
56 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") | 46 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined") |
57 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") | 47 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") |
58 | 48 |
59 # Remove the "-rdynamic" option | 49 # Remove the "-rdynamic" option |
60 # http://www.mail-archive.com/cmake@cmake.org/msg08837.html | 50 # http://www.mail-archive.com/cmake@cmake.org/msg08837.html |
61 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") | 51 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") |
62 link_libraries(uuid pthread rt dl) | 52 link_libraries(uuid pthread rt) |
53 | |
54 if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") | |
55 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") | |
56 add_definitions( | |
57 -D_LARGEFILE64_SOURCE=1 | |
58 -D_FILE_OFFSET_BITS=64 | |
59 ) | |
60 link_libraries(dl) | |
61 endif() | |
63 | 62 |
64 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | 63 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
65 add_definitions( | 64 add_definitions( |
66 -DWINVER=0x0501 | 65 -DWINVER=0x0501 |
67 -D_CRT_SECURE_NO_WARNINGS=1 | 66 -D_CRT_SECURE_NO_WARNINGS=1 |
80 link_libraries(iconv) | 79 link_libraries(iconv) |
81 | 80 |
82 endif() | 81 endif() |
83 | 82 |
84 | 83 |
84 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") | |
85 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include") | |
86 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward -fpermissive") | |
87 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -L${LSB_LIBPATH}") | |
88 endif() | |
89 | |
90 | |
91 if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") | |
92 # In FreeBSD, the "/usr/local/" folder contains the ports and need to be imported | |
93 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include") | |
94 SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include -I/usr/local/include/jsoncpp") | |
95 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib") | |
96 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L/usr/local/lib") | |
97 endif() | |
98 | |
99 | |
85 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | 100 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
86 CHECK_INCLUDE_FILES(rpc.h HAVE_UUID_H) | 101 CHECK_INCLUDE_FILES(rpc.h HAVE_UUID_H) |
87 else() | 102 else() |
88 CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H) | 103 CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H) |
89 endif() | 104 endif() |
90 | 105 |
91 if (NOT HAVE_UUID_H) | 106 if (NOT HAVE_UUID_H) |
92 message(FATAL_ERROR "Please install the uuid-dev package") | 107 message(FATAL_ERROR "Please install the uuid-dev package") |
93 endif() | 108 endif() |
94 | 109 |
110 | |
95 if (${STATIC_BUILD}) | 111 if (${STATIC_BUILD}) |
96 add_definitions(-DORTHANC_STATIC=1) | 112 add_definitions(-DORTHANC_STATIC=1) |
97 else() | 113 else() |
98 add_definitions(-DORTHANC_STATIC=0) | 114 add_definitions(-DORTHANC_STATIC=0) |
99 endif() | 115 endif() |