allow compiling with system-wide installation of boost
@@ -36,6 +36,11 @@ if (LINUX AND EXISTS "${PROJECT_SOURCE_DIR}/linux_dependencies")
include_directories (linux_dependencies)
set (EXT_LIB_PATH "${PROJECT_SOURCE_DIR}/linux_dependencies" CACHE STRING "Absolute path to libraries")
set (ODB_PATH "${EXT_LIB_PATH}/odb-2.4.0-x86_64-linux-gnu/bin/" CACHE STRING "Path to odb binaries")
+ if (EXISTS "${PROJECT_SOURCE_DIR}/linux_dependencies/boost")
+ set (SELF_COMPILED_BOOST TRUE)
+ else ()
+ set (SELF_COMPILED_BOOST FALSE)
+ endif()
elseif (OSX AND EXISTS "${PROJECT_SOURCE_DIR}/osx_dependencies")
include_directories (osx_dependencies)
set (EXT_LIB_PATH "${PROJECT_SOURCE_DIR}/osx_dependencies" CACHE STRING "Absolute path to libraries")
@@ -88,9 +93,11 @@ message(STATUS "Build type is ${CMAKE_BUILD_TYPE}")
find_package (Threads REQUIRED)
# Flags
-if (LINUX)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas") # no unknows pragmas warnings
+
+if (LINUX OR OSX)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas") # No unknown pragmas: it's ok that gcc doesn't know about ODB's pragmas
set (CMAKE_C_FLAGS " -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_OMIT_LOAD_EXTENSION") # Needed to statically link ODB
+ if (LINUX AND SELF_COMPILED_BOOST)
set (BOOST_CUSTOM_INCLUDE_DIR ${EXT_LIB_PATH}/boost)
include_directories (${BOOST_CUSTOM_INCLUDE_DIR} )
set (BOOST_LIBS_DIR ${BOOST_CUSTOM_INCLUDE_DIR}/stage/lib)
@@ -106,11 +113,10 @@ if (LINUX)
${BOOST_LIBS_DIR}/libboost_regex.a
${BOOST_LIBS_DIR}/libboost_thread.a
)
-elseif (OSX)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas") # no unknows pragmas warnings
- set (CMAKE_C_FLAGS " -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_OMIT_LOAD_EXTENSION") # Needed to statically link ODB
+ else ()
find_package (Boost COMPONENTS filesystem iostreams program_options regex log thread system REQUIRED )
include_directories (${Boost_INCLUDE_DIR} )
+ endif()
elseif (WINDOWS)
add_definitions(-DCURL_STATICLIB) # Needed to statically link libcurl
add_definitions(-DNOMINMAX) # Needed to suppress min and max definitions by Windows
