Ticket #26907: patch-CMakeLists.txt.diff

File patch-CMakeLists.txt.diff, 2.8 KB (added by richardsjohnt@…, 14 years ago)

patch for libnifalcon

  • CMakeLists.txt

    old new  
    138138  ${LIBNIFALCON_REQ_LIBS}
    139139  )
    140140
     141SET(CMAKE_SKIP_BUILD_RPATH TRUE)
     142SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
     143SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
     144SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
     145
     146
    141147ADD_SUBDIRECTORY(include)
    142148ADD_SUBDIRECTORY(src)
    143149IF(BUILD_EXAMPLES)
     
    147153  ADD_SUBDIRECTORY(lang/swig)
    148154ENDIF(BUILD_SWIG_BINDINGS)
    149155
    150 # pkg-config (use the CPack information)
    151 # FIND_PACKAGE(PkgConfig)
    152 # if(PKG_CONFIG_EXECUTABLE)
    153 #   set(PC_SHORT_NAME "${BUILDSYS_CPACK_NAME}")
    154 #   set(PC_LONG_NAME "${BUILDSYS_CPACK_NAME}")
    155 #   set(PC_LIBRARY_NAME "${LIBNIFALCON_CPP}")
    156 #   set(PC_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
    157 #   set(PC_VERSION "${LIBNIFALCON_MAJOR_VERSION}.${LIBNIFALCON_MINOR_VERSION}.${LIBNIFALCON_BUILD_VERSION}")
    158 
    159 #   if(LIBUSB_1_FOUND)
    160 #     set(PC_REQUIRES "${PC_REQUIRES}libusb-1.0 ")
    161 #     set(PC_LINK_FLAGS "${PC_LINK_FLAGS}-lnifalcon_comm_libusb ")
    162 #   endif(LIBUSB_1_FOUND)
    163 
    164 #   set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS} ${PC_LINK_FLAGS}")
    165 #   set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
    166 #   set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
    167 #   set(PC_CONFIGURED_FILE
    168 #     ${CMAKE_BINARY_DIR}/libnifalcon.pc
    169 #     )
    170 #   MESSAGE("-- Generating ${PC_CONFIGURED_FILE}")
    171 #   configure_file(
    172 #     ${CMAKE_SOURCE_DIR}/libnifalcon.pc.cmake
    173 #     ${PC_CONFIGURED_FILE}
    174 #     @ONLY
    175 #     )
    176 #   set(PKG_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
    177 #   install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
    178 # endif(PKG_CONFIG_EXECUTABLE)
     156#pkg-config (use the CPack information)
     157FIND_PACKAGE(PkgConfig)
     158if(PKG_CONFIG_EXECUTABLE)
     159  set(PC_SHORT_NAME "${BUILDSYS_CPACK_NAME}")
     160  set(PC_LONG_NAME "${BUILDSYS_CPACK_NAME}")
     161  set(PC_LIBRARY_NAME "${LIBNIFALCON_CPP}")
     162  set(PC_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
     163  set(PC_VERSION "${LIBNIFALCON_MAJOR_VERSION}.${LIBNIFALCON_MINOR_VERSION}.${LIBNIFALCON_BUILD_VERSION}")
     164
     165  if(LIBUSB_1_FOUND)
     166    set(PC_REQUIRES "${PC_REQUIRES}libusb-1.0 ")
     167    set(PC_LINK_FLAGS "${PC_LINK_FLAGS}-lnifalcon_comm_libusb ")
     168  endif(LIBUSB_1_FOUND)
     169
     170  set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS} ${PC_LINK_FLAGS}")
     171  set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
     172  set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
     173  set(PC_CONFIGURED_FILE
     174    ${CMAKE_BINARY_DIR}/libnifalcon.pc
     175    )
     176  MESSAGE("-- Generating ${PC_CONFIGURED_FILE}")
     177  configure_file(
     178    ${CMAKE_SOURCE_DIR}/libnifalcon.pc.cmake
     179    ${PC_CONFIGURED_FILE}
     180    @ONLY
     181    )
     182  set(PKG_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
     183  install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
     184endif(PKG_CONFIG_EXECUTABLE)