diff --git a/CMakeLists.txt b/CMakeLists.txt index 661c0efc..a4201c62 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,17 +8,6 @@ option(BUILD_ORM "Build orm" ON) option(LIBPQ_BATCH_MODE "Use batch mode for libpq" ON) option(BUILD_DROGON_SHARED "Build drogon as a shared lib" OFF) -if(BUILD_DROGON_SHARED) - set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) - list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) - if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") - endif("${isSystemDir}" STREQUAL "-1") - add_library(${PROJECT_NAME} SHARED) -else() - add_library(${PROJECT_NAME} STATIC) -endif() - set(DROGON_MAJOR_VERSION 1) set(DROGON_MINOR_VERSION 0) set(DROGON_PATCH_VERSION 0) @@ -52,6 +41,17 @@ foreach(p endif() endforeach() +if(BUILD_DROGON_SHARED) + set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${INSTALL_LIB_DIR}" isSystemDir) + if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${INSTALL_LIB_DIR}") + endif("${isSystemDir}" STREQUAL "-1") + add_library(${PROJECT_NAME} SHARED) +else() + add_library(${PROJECT_NAME} STATIC) +endif() + include(CheckIncludeFileCXX) check_include_file_cxx(any HAS_ANY)