[cmake] add RDTK_FORCE_STATIC_BUILD
since rdtk is only used by shadow server add an option to directly link it with -DRDTK_FORCE_STATIC_BUILD=ON without installing any header or library
This commit is contained in:
parent
9a62d05943
commit
e8f5f90603
@ -81,6 +81,11 @@ include(GNUInstallDirsWrapper)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include (SetFreeRDPCMakeInstallDir)
|
||||
|
||||
option(RDTK_FORCE_STATIC_BUILD "Force RDTK to be build as static libary" OFF)
|
||||
if (RDTK_FORCE_STATIC_BUILD)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
|
||||
add_definitions(-DRDTK_EXPORTS)
|
||||
|
||||
if (NOT IOS)
|
||||
@ -109,7 +114,9 @@ add_subdirectory(librdtk)
|
||||
add_subdirectory(templates)
|
||||
add_subdirectory(include)
|
||||
|
||||
if (NOT RDTK_FORCE_STATIC_BUILD)
|
||||
install(EXPORT rdtk DESTINATION ${RDTK_CMAKE_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
if(WITH_SAMPLE)
|
||||
if(WITH_X11)
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
if (NOT RDTK_FORCE_STATIC_BUILD)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
DESTINATION ${RDTK_INCLUDE_DIR}
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
@ -5,4 +7,4 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
|
||||
DESTINATION ${RDTK_INCLUDE_DIR}
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
||||
endif()
|
||||
|
@ -71,6 +71,7 @@ if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
if (NOT RDTK_FORCE_STATIC_BUILD)
|
||||
install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT rdtk
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
@ -80,3 +81,4 @@ if (WITH_DEBUG_SYMBOLS AND MSVC AND BUILD_SHARED_LIBS)
|
||||
get_target_property(OUTPUT_FILENAME ${MODULE_NAME} OUTPUT_NAME)
|
||||
install(FILES ${CMAKE_PDB_BINARY_DIR}/${OUTPUT_FILENAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,4 +1,5 @@
|
||||
|
||||
if (NOT RDTK_FORCE_STATIC_BUILD)
|
||||
include (SetFreeRDPCMakeInstallDir)
|
||||
|
||||
# cmake package
|
||||
@ -14,6 +15,7 @@ write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake
|
||||
VERSION ${RDTK_VERSION}
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
endif()
|
||||
|
||||
set(RDTK_BUILD_CONFIG_LIST "")
|
||||
GET_CMAKE_PROPERTY(res VARIABLES)
|
||||
@ -30,6 +32,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_D
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/buildflags.h)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/build-config.h)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/config.h)
|
||||
|
||||
if (NOT RDTK_FORCE_STATIC_BUILD)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rdtk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc @ONLY)
|
||||
|
||||
set(RDTK_INSTALL_INCLUDE_DIR ${RDTK_INCLUDE_DIR}/rdtk)
|
||||
@ -41,5 +45,4 @@ install(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake
|
||||
DESTINATION ${RDTK_CMAKE_INSTALL_DIR})
|
||||
|
||||
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user