Skip to content

Commit

Permalink
Use INSTALL_LIB_DIR instead of 'CMAKE_INSTALL_PREFIX/lib' in CMakeLis…
Browse files Browse the repository at this point in the history
  • Loading branch information
an-tao authored Dec 12, 2019
1 parent 832c6cb commit cc04a01
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cc04a01

Please sign in to comment.