un-lint CMakeLists.txt
This commit is contained in:
parent
e5f12347bd
commit
9e09168597
@ -23,12 +23,12 @@ else()
|
|||||||
message(WARNING "Building on a 32 bit system is unsupported")
|
message(WARNING "Building on a 32 bit system is unsupported")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32 AND MSVC_VERSION LESS 1800)
|
if(WIN32 AND MSVC_VERSION LESS 1800)
|
||||||
message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
|
message(FATAL_ERROR "Building with Microsoft compiler needs Visual Studio 2013 or later (Express version works too)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
OPTION(WITH_TOOLS "Build OSRM tools" OFF)
|
option(WITH_TOOLS "Build OSRM tools" OFF)
|
||||||
OPTION(BUILD_TOOLS "Build OSRM tools" OFF)
|
option(BUILD_TOOLS "Build OSRM tools" OFF)
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/include/)
|
include_directories(${CMAKE_SOURCE_DIR}/include/)
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/third_party/)
|
include_directories(${CMAKE_SOURCE_DIR}/third_party/)
|
||||||
@ -123,10 +123,10 @@ if(CMAKE_BUILD_TYPE MATCHES Release)
|
|||||||
# Check if LTO is available
|
# Check if LTO is available
|
||||||
set(LTO_FLAGS "")
|
set(LTO_FLAGS "")
|
||||||
check_cxx_compiler_flag("-flto" LTO_AVAILABLE)
|
check_cxx_compiler_flag("-flto" LTO_AVAILABLE)
|
||||||
if (LTO_AVAILABLE)
|
if(LTO_AVAILABLE)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
|
||||||
set(CHECK_LTO_SRC "int main(){return 0;}")
|
set(CHECK_LTO_SRC "int main(){return 0;}")
|
||||||
CHECK_CXX_SOURCE_COMPILES("${CHECK_LTO_SRC}" LTO_WORKS)
|
check_cxx_source_compiles("${CHECK_LTO_SRC}" LTO_WORKS)
|
||||||
if(LTO_WORKS)
|
if(LTO_WORKS)
|
||||||
message(STATUS "LTO working")
|
message(STATUS "LTO working")
|
||||||
else()
|
else()
|
||||||
@ -135,17 +135,17 @@ if(CMAKE_BUILD_TYPE MATCHES Release)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
|
# Since gcc 4.9 the LTO format is non-standart ('slim'), so we need to use the build-in tools
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND
|
||||||
NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0" AND NOT MINGW)
|
NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9.0" AND NOT MINGW)
|
||||||
message(STATUS "Using gcc specific binutils for LTO.")
|
message(STATUS "Using gcc specific binutils for LTO.")
|
||||||
set(CMAKE_AR "/usr/bin/gcc-ar")
|
set(CMAKE_AR "/usr/bin/gcc-ar")
|
||||||
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
|
set(CMAKE_RANLIB "/usr/bin/gcc-ranlib")
|
||||||
endif()
|
endif()
|
||||||
endif ()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT WIN32)
|
if(NOT WIN32)
|
||||||
add_definitions(-DBOOST_TEST_DYN_LINK)
|
add_definitions(-DBOOST_TEST_DYN_LINK)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Configuring compilers
|
# Configuring compilers
|
||||||
@ -155,16 +155,16 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunreachable-code -pedantic -fPIC")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunreachable-code -pedantic -fPIC")
|
||||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
set(COLOR_FLAG "-fdiagnostics-color=auto")
|
set(COLOR_FLAG "-fdiagnostics-color=auto")
|
||||||
CHECK_CXX_COMPILER_FLAG("-fdiagnostics-color=auto" HAS_COLOR_FLAG)
|
check_cxx_compiler_flag("-fdiagnostics-color=auto" HAS_COLOR_FLAG)
|
||||||
if(NOT HAS_COLOR_FLAG)
|
if(NOT HAS_COLOR_FLAG)
|
||||||
set(COLOR_FLAG "")
|
set(COLOR_FLAG "")
|
||||||
endif()
|
endif()
|
||||||
# using GCC
|
# using GCC
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -fPIC ${COLOR_FLAG}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -fPIC ${COLOR_FLAG}")
|
||||||
if (WIN32) # using mingw
|
if(WIN32) # using mingw
|
||||||
add_definitions(-D_USE_MATH_DEFINES) # define M_PI, M_1_PI etc.
|
add_definitions(-D_USE_MATH_DEFINES) # define M_PI, M_1_PI etc.
|
||||||
add_definitions(-DWIN32)
|
add_definitions(-DWIN32)
|
||||||
SET(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
|
set(OPTIONAL_SOCKET_LIBS ws2_32 wsock32)
|
||||||
endif()
|
endif()
|
||||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||||
# using Intel C++
|
# using Intel C++
|
||||||
@ -275,8 +275,8 @@ target_link_libraries(osrm-prepare ${STXXL_LIBRARY})
|
|||||||
set(OpenMP_FIND_QUIETLY ON)
|
set(OpenMP_FIND_QUIETLY ON)
|
||||||
find_package(OpenMP)
|
find_package(OpenMP)
|
||||||
if(OPENMP_FOUND)
|
if(OPENMP_FOUND)
|
||||||
message(STATUS "OpenMP support found. Linking just in case for stxxl")
|
message(STATUS "OpenMP support found. Linking just in case for stxxl")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(OSMPBF REQUIRED)
|
find_package(OSMPBF REQUIRED)
|
||||||
@ -355,11 +355,11 @@ install(TARGETS OSRM DESTINATION lib)
|
|||||||
list(GET Boost_LIBRARIES 1 BOOST_LIBRARY_FIRST)
|
list(GET Boost_LIBRARIES 1 BOOST_LIBRARY_FIRST)
|
||||||
get_filename_component(BOOST_LIBRARY_LISTING "${BOOST_LIBRARY_FIRST}" PATH)
|
get_filename_component(BOOST_LIBRARY_LISTING "${BOOST_LIBRARY_FIRST}" PATH)
|
||||||
set(BOOST_LIBRARY_LISTING "-L${BOOST_LIBRARY_LISTING}")
|
set(BOOST_LIBRARY_LISTING "-L${BOOST_LIBRARY_LISTING}")
|
||||||
foreach (lib ${Boost_LIBRARIES})
|
foreach(lib ${Boost_LIBRARIES})
|
||||||
get_filename_component(BOOST_LIBRARY_NAME "${lib}" NAME_WE)
|
get_filename_component(BOOST_LIBRARY_NAME "${lib}" NAME_WE)
|
||||||
string(REPLACE "lib" "" BOOST_LIBRARY_NAME ${BOOST_LIBRARY_NAME})
|
string(REPLACE "lib" "" BOOST_LIBRARY_NAME ${BOOST_LIBRARY_NAME})
|
||||||
set(BOOST_LIBRARY_LISTING "${BOOST_LIBRARY_LISTING} -l${BOOST_LIBRARY_NAME}")
|
set(BOOST_LIBRARY_LISTING "${BOOST_LIBRARY_LISTING} -l${BOOST_LIBRARY_NAME}")
|
||||||
endforeach ()
|
endforeach()
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
|
||||||
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
|
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION lib/pkgconfig)
|
||||||
|
Loading…
Reference in New Issue
Block a user