Skip to content

Commit

Permalink
fix CMake to support cmake --install --prefix <new_path>
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume GAUTIER authored and Jovasa committed Apr 10, 2024
1 parent d8c9688 commit b0be7d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ option(BUILD_TESTS "Build tests" ON)
option(USE_CRYPTO "Use crypto library" OFF)

include(GNUInstallDirs) #Helps to define correct distro specific install directories
set(DEFERRED "@")

set(KVAZAAR_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "kvazaar library install path")
set(KVAZAAR_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH "kvazaar binary install path")
Expand Down Expand Up @@ -113,7 +114,7 @@ else()
endif()

# Apply dynamic info to the config files
configure_file("${PROJECT_SOURCE_DIR}/src/kvazaarCMake.pc.in" "${PROJECT_SOURCE_DIR}/src/kvazaar.pc" @ONLY)
configure_file("${PROJECT_SOURCE_DIR}/src/kvazaarCMake.pc.in" "${PROJECT_SOURCE_DIR}/src/kvazaar.pc.temp" @ONLY)
configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_SOURCE_DIR}/src/version.h" @ONLY)

# Add all sources in src/ base
Expand Down Expand Up @@ -302,6 +303,7 @@ source_group( "" FILES ${SOURCE_GROUP_TOPLEVEL})
# INSTALL

# ToDo: make configurable
install(CODE "configure_file(\"${PROJECT_SOURCE_DIR}/src/kvazaar.pc.temp\" \"${PROJECT_SOURCE_DIR}/src/kvazaar.pc\" @ONLY)")

install(FILES ${PROJECT_SOURCE_DIR}/src/kvazaar.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(TARGETS kvazaar-bin DESTINATION ${CMAKE_INSTALL_BINDIR})
Expand Down
2 changes: 1 addition & 1 deletion src/kvazaarCMake.pc.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@
prefix=@DEFERRED@CMAKE_INSTALL_PREFIX@DEFERRED@
exec_prefix=${prefix}
libdir=@KVAZAAR_PC_LIBDIR@
incdir=@KVAZAAR_PC_INCDIR@
Expand Down

0 comments on commit b0be7d5

Please sign in to comment.