Commit ba1d42311f7fedbccf88a11daa9a459657a5db4b
1 parent
702deb64
CMake add build dependencies and improve portability
Showing
1 changed file
with
17 additions
and
5 deletions
CMakeLists.txt
| ... | ... | @@ -17,11 +17,28 @@ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) |
| 17 | 17 | endif(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) |
| 18 | 18 | |
| 19 | 19 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -Wall") |
| 20 | +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | |
| 20 | 21 | |
| 21 | 22 | # Print out compiler commands |
| 22 | 23 | # set(CMAKE_VERBOSE_MAKEFILE ON) |
| 23 | 24 | |
| 24 | 25 | # --------------------------------------------------------- |
| 26 | +# Check for required dependencies | |
| 27 | +# --------------------------------------------------------- | |
| 28 | +if(CMAKE_VERSION VERSION_GREATER 2.8.5 OR CMAKE_VERSION VERSION_EQUAL 2.8.5) | |
| 29 | + include(GNUInstallDirs) | |
| 30 | +endif() | |
| 31 | + | |
| 32 | +find_package(Threads REQUIRED) | |
| 33 | +find_package(hiredis REQUIRED) | |
| 34 | +find_package(libev REQUIRED) | |
| 35 | + | |
| 36 | +set(REDOX_LIB_DEPS | |
| 37 | + ${HIREDIS_LIBRARIES} | |
| 38 | + ${LIBEV_LIBRARIES} | |
| 39 | + ${CMAKE_THREAD_LIBS_INIT}) | |
| 40 | + | |
| 41 | +# --------------------------------------------------------- | |
| 25 | 42 | # Source files |
| 26 | 43 | # --------------------------------------------------------- |
| 27 | 44 | |
| ... | ... | @@ -49,11 +66,6 @@ set(INC_REDOX_ALL ${INC_REDOX_CORE} ${INC_REDOX_UTILS} ${INC_REDOX_WRAPPER}) |
| 49 | 66 | include_directories(${INC_REDOX_DIR}) |
| 50 | 67 | include_directories(${INC_REDOX_DIR}/redox) |
| 51 | 68 | |
| 52 | -# Dependent libraries - you may have to change | |
| 53 | -# pthread to whatever C++11 threads depends on | |
| 54 | -# for your platform | |
| 55 | -set(REDOX_LIB_DEPS ev pthread hiredis) | |
| 56 | - | |
| 57 | 69 | # --------------------------------------------------------- |
| 58 | 70 | # Library generation |
| 59 | 71 | # --------------------------------------------------------- | ... | ... |