Fix cmake builds for RPM packaging
Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
parent
4233362bf0
commit
e9600507ef
1 changed files with 35 additions and 33 deletions
|
@ -66,24 +66,26 @@ option(PIHELPER_STATIC "Build Pi-Helper as a static library" ON)
|
||||||
option(PIHELPER_SHARED "Build Pi-Helper as a shared library" OFF)
|
option(PIHELPER_SHARED "Build Pi-Helper as a shared library" OFF)
|
||||||
option(PIHELPER_EXECUTABLE "Build Pi-Helper as an executable" OFF)
|
option(PIHELPER_EXECUTABLE "Build Pi-Helper as an executable" OFF)
|
||||||
option(PIHELPER_DEV "Install Pi-Helper header files for development" OFF)
|
option(PIHELPER_DEV "Install Pi-Helper header files for development" OFF)
|
||||||
|
option(PIHELPER_RPM "Apply custom config for building RPM packages" OFF)
|
||||||
|
|
||||||
if (PIHELPER_STATIC)
|
if (PIHELPER_STATIC)
|
||||||
add_library(libpihelperstatic STATIC
|
add_library(libpihelperstatic STATIC
|
||||||
${PIHELPER_SOURCES}
|
${PIHELPER_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(libpihelperstatic PROPERTIES OUTPUT_NAME "pihelper")
|
set_target_properties(libpihelperstatic PROPERTIES OUTPUT_NAME "pihelper"
|
||||||
set_target_properties(libpihelperstatic PROPERTIES VERSION ${PROJECT_VERSION})
|
VERSION ${PROJECT_VERSION}
|
||||||
set_target_properties(libpihelperstatic PROPERTIES PUBLIC_HEADER pihelper.h)
|
PUBLIC_HEADER pihelper.h
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(libpihelperstatic ${CURL})
|
target_link_libraries(libpihelperstatic ${CURL}
|
||||||
target_link_libraries(libpihelperstatic ${JSONC})
|
${JSONC}
|
||||||
target_link_libraries(libpihelperstatic ${CRYPTO})
|
${CRYPTO}
|
||||||
target_link_libraries(libpihelperstatic ${OPENSSL})
|
${OPENSSL}
|
||||||
|
)
|
||||||
|
|
||||||
install(TARGETS libpihelperstatic
|
install(TARGETS libpihelperstatic
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -92,41 +94,41 @@ if (PIHELPER_SHARED OR PIHELPER_EXECUTABLE)
|
||||||
${PIHELPER_SOURCES}
|
${PIHELPER_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(libpihelpershared PROPERTIES OUTPUT_NAME "pihelper")
|
set_target_properties(libpihelpershared PROPERTIES
|
||||||
set_target_properties(libpihelpershared PROPERTIES VERSION ${PROJECT_VERSION})
|
OUTPUT_NAME "pihelper"
|
||||||
set_target_properties(libpihelpershared PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
|
VERSION ${PROJECT_VERSION}
|
||||||
set_target_properties(libpihelpershared PROPERTIES PUBLIC_HEADER pihelper.h)
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||||
|
|
||||||
target_link_libraries(libpihelpershared ${CURL})
|
|
||||||
target_link_libraries(libpihelpershared ${JSONC})
|
|
||||||
target_link_libraries(libpihelpershared ${CRYPTO})
|
|
||||||
target_link_libraries(libpihelpershared ${OPENSSL})
|
|
||||||
|
|
||||||
install(TARGETS libpihelpershared
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
||||||
)
|
)
|
||||||
endif()
|
message("shared major version: ${PROJECT_VERSION_MAJOR}")
|
||||||
|
if (PIHELPER_DEV)
|
||||||
|
set_target_properties(libpihelpershared PROPERTIES PUBLIC_HEADER pihelper.h)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (PIHELPER_DEV)
|
target_link_libraries(libpihelpershared ${CURL}
|
||||||
install(FILES PiHelper/pihelper.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/pihelper")
|
${JSONC}
|
||||||
|
${CRYPTO}
|
||||||
|
${OPENSSL}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS libpihelpershared)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PIHELPER_EXECUTABLE)
|
if (PIHELPER_EXECUTABLE)
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
if (NOT PIHELPER_RPM)
|
||||||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(pihelper
|
add_executable(pihelper
|
||||||
cli.c
|
cli.c
|
||||||
)
|
)
|
||||||
|
|
||||||
message("Setting RPATH to ${CMAKE_INSTALL_RPATH}")
|
target_link_libraries(pihelper libpihelpershared
|
||||||
|
${CURL}
|
||||||
target_link_libraries(pihelper libpihelpershared)
|
${JSONC}
|
||||||
target_link_libraries(pihelper ${CURL})
|
${CRYPTO}
|
||||||
target_link_libraries(pihelper ${JSONC})
|
${OPENSSL}
|
||||||
target_link_libraries(pihelper ${CRYPTO})
|
)
|
||||||
target_link_libraries(pihelper ${OPENSSL})
|
|
||||||
|
|
||||||
install(TARGETS pihelper
|
install(TARGETS pihelper
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
|
Loading…
Reference in a new issue