Modern CMake: export shared libraries and fltk-options

This commit is contained in:
Albrecht Schlosser 2024-02-10 14:19:09 +01:00
parent 809ceea075
commit f4af40fe55
2 changed files with 16 additions and 1 deletions

View File

@ -59,9 +59,22 @@ if(0) # Debug
message(STATUS "##############################################################") message(STATUS "##############################################################")
endif() endif()
# set fltk-options export names (built or not, Windows)
if(FLTK_BUILD_FLTK_OPTIONS)
set(FLTK_OPTIONS_EXPORT fltk-options)
if(WIN32)
list(APPEND FLTK_OPTIONS_EXPORT fltk-options-cmd)
endif()
else()
set(FLTK_OPTIONS_EXPORT)
endif()
# generate FLTK-Targets.cmake for build directory use # generate FLTK-Targets.cmake for build directory use
export(TARGETS export(TARGETS
${FLUID_EXPORT} ${FLTK_LIBRARIES} ${FLTK_LIBRARIES}
${FLTK_LIBRARIES_SHARED}
${FLUID_EXPORT}
${FLTK_OPTIONS_EXPORT}
FILE FILE
${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake
NAMESPACE NAMESPACE

View File

@ -45,6 +45,7 @@ else()
endif() endif()
target_link_libraries(fltk-options PRIVATE fltk::fltk) target_link_libraries(fltk-options PRIVATE fltk::fltk)
set_target_properties(fltk-options PROPERTIES EXPORT_NAME options)
# Add the console app (Windows only) # Add the console app (Windows only)
# This is done for all Windows targets, even if cross-compiling. # This is done for all Windows targets, even if cross-compiling.
@ -53,6 +54,7 @@ if(WIN32)
list(APPEND TARGETS fltk-options-cmd) list(APPEND TARGETS fltk-options-cmd)
add_executable(fltk-options-cmd fltk-options.cxx) add_executable(fltk-options-cmd fltk-options.cxx)
target_link_libraries(fltk-options-cmd PRIVATE fltk::fltk) target_link_libraries(fltk-options-cmd PRIVATE fltk::fltk)
set_target_properties(fltk-options-cmd PROPERTIES EXPORT_NAME options-cmd)
endif() endif()
# Create aliases for all executables, # Create aliases for all executables,