From 9d71d006cc84c6e09a48737f52086b072c45c83a Mon Sep 17 00:00:00 2001 From: Thanabodee Charoenpiriyakij Date: Wed, 10 Feb 2016 18:33:48 +0700 Subject: [PATCH] Fix libdir is wrong when compile with cmake because JANSSON_INSTALL_LIB_DIR is set to /usr/local/lib after foreach loop --- CMakeLists.txt | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bfe8604..80ea388 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -318,19 +318,6 @@ check_c_source_compiles ("int main() { char l; unsigned long v; __atomic_test_an set (JANSSON_INITIAL_HASHTABLE_ORDER 3 CACHE STRING "Number of buckets new object hashtables contain is 2 raised to this power. The default is 3, so empty hashtables contain 2^3 = 8 buckets.") -# Create pkg-conf file. -# (We use the same files as ./configure does, so we -# have to defined the same variables used there). -if(NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR lib) -endif(NOT DEFINED CMAKE_INSTALL_LIBDIR) -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix ${CMAKE_INSTALL_PREFIX}) -set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) -set(VERSION ${JANSSON_DISPLAY_VERSION}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jansson.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/jansson.pc @ONLY) - # configure the public config file configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/jansson_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/jansson_config.h) @@ -618,6 +605,16 @@ endif() set(JANSSON_INSTALL_CMAKE_DIR ${DEF_INSTALL_CMAKE_DIR} CACHE PATH "Installation directory for CMake files") +# Create pkg-conf file. +# (We use the same files as ./configure does, so we +# have to defined the same variables used there). +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${CMAKE_INSTALL_PREFIX}) +set(libdir ${CMAKE_INSTALL_PREFIX}/${JANSSON_INSTALL_LIB_DIR}) +set(VERSION ${JANSSON_DISPLAY_VERSION}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jansson.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/jansson.pc @ONLY) + # Make sure the paths are absolute. foreach(p LIB BIN INCLUDE CMAKE) set(var JANSSON_INSTALL_${p}_DIR) @@ -665,16 +662,6 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/JanssonConfigVersion.cmake.in set_target_properties(jansson PROPERTIES PUBLIC_HEADER "${JANSSON_HDR_PUBLIC}") #TODO: fix this. -# Create pkg-conf file. -# (We use the same files as ./configure does, so we -# have to defined the same variables used there). -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix ${CMAKE_INSTALL_PREFIX}) -set(libdir ${CMAKE_INSTALL_PREFIX}/${JANSSON_INSTALL_LIB_DIR}) -set(VERSION ${JANSSON_DISPLAY_VERSION}) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jansson.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/jansson.pc @ONLY) - # # Install targets. #