Skip to content

Commit

Permalink
Made some CMake improvements related to the export and install calls
Browse files Browse the repository at this point in the history
- A new undocumented TGUI_INSTALL option is added. TGUI_INSTALL is ON by default, unless SDL or GLFW is being build in the same project and the corresponding option in these dependencies is turned OFF.
- The undocumented TGUI_SKIP_EXPORT option was removed (when turned ON, it had a similar effect to setting the new TGUI_INSTALL option to OFF).
- The TGUIConfig.cmake file is no longer generated inside the build directory when TGUI is being build from inside a subdirectory of another CMake project. Generating the file in this case is now broken in combination with SFML 3 and never worked with a non-SFML backend.
  • Loading branch information
texus committed Dec 16, 2023
1 parent 1d89e86 commit 7f85eb4
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 140 deletions.
84 changes: 49 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,19 @@ endif()
# Set the path for the libraries
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib")

# Don't create an install target if we detect a dependency that is being build without an install target
if (NOT DEFINED TGUI_INSTALL)
if ((DEFINED SDL2_DISABLE_INSTALL AND SDL2_DISABLE_INSTALL)
OR (DEFINED SDL_DISABLE_INSTALL AND SDL_DISABLE_INSTALL)
OR (DEFINED SDL2TTF_INSTALL AND NOT SDL2TTF_INSTALL)
OR (DEFINED SDL3TTF_INSTALL AND NOT SDL3TTF_INSTALL)
OR (DEFINED GLFW_INSTALL AND NOT GLFW_INSTALL))
set(TGUI_INSTALL OFF)
else()
set(TGUI_INSTALL ON)
endif()
endif()

# Define the macros to link TGUI to its dependencies
include(${PROJECT_SOURCE_DIR}/cmake/Dependencies.cmake)

Expand Down Expand Up @@ -355,46 +368,47 @@ if(TGUI_BUILD_DOC)
add_subdirectory(doc)
endif()

# Install pkg-config files by default on Linux (and BSD)
tgui_assign_bool(TGUI_INSTALL_PKGCONFIG_DEFAULT TGUI_OS_LINUX)
option(TGUI_INSTALL_PKGCONFIG_FILES "TRUE to automatically install pkg-config files so other projects can find TGUI" ${TGUI_INSTALL_PKGCONFIG_DEFAULT})
if (TGUI_INSTALL)
# Install pkg-config files by default on Linux (and BSD)
tgui_assign_bool(TGUI_INSTALL_PKGCONFIG_DEFAULT TGUI_OS_LINUX)
option(TGUI_INSTALL_PKGCONFIG_FILES "TRUE to automatically install pkg-config files so other projects can find TGUI" ${TGUI_INSTALL_PKGCONFIG_DEFAULT})

if (TGUI_INSTALL_PKGCONFIG_FILES)
tgui_set_option(TGUI_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${TGUI_PKGCONFIG_DIR}" PATH "Install directory for TGUI's pkg-config .pc files")
if (TGUI_INSTALL_PKGCONFIG_FILES)
tgui_set_option(TGUI_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${TGUI_PKGCONFIG_DIR}" PATH "Install directory for TGUI's pkg-config .pc files")

configure_file("cmake/pkgconfig/tgui.pc.in" "pkgconfig/tgui.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/tgui.pc" DESTINATION "${TGUI_PKGCONFIG_INSTALL_PREFIX}")
endif()
configure_file("cmake/pkgconfig/tgui.pc.in" "pkgconfig/tgui.pc" @ONLY)
endif()

# Install include files
if(NOT TGUI_BUILD_FRAMEWORK)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT devel
PATTERN "*.in" EXCLUDE)
endif()
# Install include files
if(NOT TGUI_BUILD_FRAMEWORK)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT devel
PATTERN "*.in" EXCLUDE)
endif()

# Install PDB file
if(TGUI_GENERATE_PDB)
# When using a Visual Studio generator, the pdb files are located in Debug and RelWithDebInfo subfolders, but not when
# using single-configuration generators such as NMake Makefiles.
# When using Linker PDB files (i.e. TGUI_SHARED_LIBS=FALSE), CMake 3.13 introduced a generator expression that helps us.
# Linker PDB files are installed next to the dll file (where VS searches them) while compiler PDB files are placed next to the lib file.
if(TGUI_SHARED_LIBS)
install (FILES $<TARGET_PDB_FILE:tgui> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL COMPONENT devel)
else()
# TODO: Find a reliable way to know whether the file has a "-d" postfix instead of trying to install both. OPTIONAL is also required when config is Release.
if (MSVC_IDE)
install(FILES "${PROJECT_BINARY_DIR}/lib/\${CMAKE_INSTALL_CONFIG_NAME}/tgui-s.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
install(FILES "${PROJECT_BINARY_DIR}/lib/\${CMAKE_INSTALL_CONFIG_NAME}/tgui-s-d.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
# Install PDB file
if(TGUI_GENERATE_PDB)
# When using a Visual Studio generator, the pdb files are located in Debug and RelWithDebInfo subfolders, but not when
# using single-configuration generators such as NMake Makefiles.
# When using Linker PDB files (i.e. TGUI_SHARED_LIBS=FALSE), CMake 3.13 introduced a generator expression that helps us.
# Linker PDB files are installed next to the dll file (where VS searches them) while compiler PDB files are placed next to the lib file.
if(TGUI_SHARED_LIBS)
install(FILES $<TARGET_PDB_FILE:tgui> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL COMPONENT devel)
else()
install(FILES "${PROJECT_BINARY_DIR}/lib/tgui-s.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
install(FILES "${PROJECT_BINARY_DIR}/lib/tgui-s-d.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
# TODO: Find a reliable way to know whether the file has a "-d" postfix instead of trying to install both. OPTIONAL is also required when config is Release.
if (MSVC_IDE)
install(FILES "${PROJECT_BINARY_DIR}/lib/\${CMAKE_INSTALL_CONFIG_NAME}/tgui-s.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
install(FILES "${PROJECT_BINARY_DIR}/lib/\${CMAKE_INSTALL_CONFIG_NAME}/tgui-s-d.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
else()
install(FILES "${PROJECT_BINARY_DIR}/lib/tgui-s.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
install(FILES "${PROJECT_BINARY_DIR}/lib/tgui-s-d.pdb" DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel OPTIONAL)
endif()
endif()
endif()
endif()

# Install miscellaneous files
install(FILES license.txt DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY themes DESTINATION "${TGUI_MISC_INSTALL_PREFIX}")
# Install miscellaneous files
install(FILES license.txt DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY themes DESTINATION "${TGUI_MISC_INSTALL_PREFIX}")
endif()
2 changes: 1 addition & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ macro(tgui_add_dependency_sfml component)
tgui_find_dependency_sfml(${component} "")

# Link to SFML and set include and library search directories
if (SFML_VERSION VERSION_GREATER_EQUAL 3)
if (SFML_VERSION VERSION_GREATER_EQUAL 3 OR TARGET SFML::${component}) # SFML_VERSION can be undefined if target already existed and wasn't searched by TGUI
target_link_libraries(tgui PUBLIC SFML::${component})
else()
string(TOLOWER ${component} lowercase_component)
Expand Down
60 changes: 5 additions & 55 deletions cmake/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,58 +114,6 @@ function(tgui_set_stdlib target)
endif()
endfunction()

# Generate a TGUIConfig.cmake file (and associated files)
function(tgui_export_target export_name)
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${PROJECT_BINARY_DIR}/TGUIConfigVersion.cmake"
VERSION ${TGUI_VERSION_MAJOR}.${TGUI_VERSION_MINOR}.${TGUI_VERSION_PATCH}
COMPATIBILITY SameMajorVersion)

if (TGUI_SHARED_LIBS)
set(targets_config_filename TGUISharedTargets.cmake)
else()
set(targets_config_filename TGUIStaticTargets.cmake)
endif()

export(EXPORT ${export_name}
NAMESPACE TGUI::
FILE "${PROJECT_BINARY_DIR}/${targets_config_filename}")

if (TGUI_BUILD_FRAMEWORK)
set(config_package_location "TGUI.framework/Resources/CMake")
else()
set(config_package_location ${CMAKE_INSTALL_LIBDIR}/cmake/TGUI)
endif()

configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/TGUIConfig.cmake.in" "${PROJECT_BINARY_DIR}/TGUIConfig.cmake"
INSTALL_DESTINATION "${config_package_location}")

install(EXPORT ${export_name}
NAMESPACE TGUI::
FILE ${targets_config_filename}
DESTINATION ${config_package_location})

install(FILES "${PROJECT_BINARY_DIR}/TGUIConfig.cmake"
"${PROJECT_BINARY_DIR}/TGUIConfigVersion.cmake"
DESTINATION ${config_package_location}
COMPONENT devel)

# Install the find modules when they are needed to find our dependencies
if(TGUI_HAS_WINDOW_BACKEND_GLFW AND NOT TGUI_FOUND_GLFW_CONFIG)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/Modules/Findglfw3.cmake" DESTINATION ${config_package_location} COMPONENT devel)
add_custom_command(TARGET tgui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/cmake/Modules/Findglfw3.cmake" "${PROJECT_BINARY_DIR}/" VERBATIM)
endif()
if((TGUI_HAS_WINDOW_BACKEND_SDL OR TGUI_HAS_FONT_BACKEND_SDL_TTF) AND NOT TGUI_FOUND_SDL2_CONFIG)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2.cmake" DESTINATION ${config_package_location} COMPONENT devel)
add_custom_command(TARGET tgui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2.cmake" "${PROJECT_BINARY_DIR}/" VERBATIM)
endif()
if(TGUI_HAS_FONT_BACKEND_SDL_TTF AND NOT TGUI_FOUND_SDL2_TTF_CONFIG)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2_ttf.cmake" DESTINATION ${config_package_location} COMPONENT devel)
add_custom_command(TARGET tgui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2_ttf.cmake" "${PROJECT_BINARY_DIR}/" VERBATIM)
endif()
endfunction()


# Install the dlls next to the executables (both immediately after building and when installing them somewhere)
function(copy_dlls_to_exe post_build_destination install_destination target)
if(TGUI_OS_WINDOWS)
Expand Down Expand Up @@ -207,9 +155,11 @@ function(copy_dlls_to_exe post_build_destination install_destination target)
COMMAND ${CMAKE_COMMAND} -E copy "${file_to_copy}" "${post_build_destination}"
VERBATIM)

install(FILES "${file_to_copy}"
DESTINATION "${install_destination}"
COMPONENT ${target})
if (TGUI_INSTALL)
install(FILES "${file_to_copy}"
DESTINATION "${install_destination}"
COMPONENT ${target})
endif()
endforeach()
endif()
endfunction()
Expand Down
1 change: 0 additions & 1 deletion examples/android/SDL_RENDERER/app/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ add_subdirectory("${TGUI_ROOT_DIR}/../SDL2" ${SDL2_BUILD_DIR})
add_subdirectory("${TGUI_ROOT_DIR}/../SDL2_ttf" ${SDL2_TTF_BUILD_DIR})

# Build TGUI
set(TGUI_SKIP_EXPORT ON) # Workaround for issue when building SDL and TGUI together as subdirectories
add_subdirectory("${TGUI_ROOT_DIR}" TGUI-build)

# Create the libmain.so library that contains the application's c++ code.
Expand Down
1 change: 0 additions & 1 deletion examples/android/SDL_TTF_GLES2/app/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ add_subdirectory("${TGUI_ROOT_DIR}/../SDL2" ${SDL2_BUILD_DIR})
add_subdirectory("${TGUI_ROOT_DIR}/../SDL2_ttf" ${SDL2_TTF_BUILD_DIR})

# Build TGUI
set(TGUI_SKIP_EXPORT ON) # Workaround for issue when building SDL and TGUI together as subdirectories
add_subdirectory("${TGUI_ROOT_DIR}" TGUI-build)

# Create the libmain.so library that contains the application's c++ code.
Expand Down
44 changes: 23 additions & 21 deletions gui-builder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,29 @@ if (TGUI_SHARED_LIBS AND TGUI_OS_LINUX)
INSTALL_RPATH "$ORIGIN/${rel_lib_dir}")
endif()

# Install a .desktop file on Linux (and its icon)
if (TGUI_OS_LINUX)
set(TGUI_GUI_BUILDER_INSTALL_EXE_PATH "${CMAKE_INSTALL_PREFIX}/${target_install_dir}/gui-builder")
configure_file("${PROJECT_SOURCE_DIR}/cmake/gui-builder/tgui-gui-builder.desktop.in" "tgui-gui-builder.desktop" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tgui-gui-builder.desktop"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
if (TGUI_INSTALL)
# Install a .desktop file on Linux (and its icon)
if (TGUI_OS_LINUX)
set(TGUI_GUI_BUILDER_INSTALL_EXE_PATH "${CMAKE_INSTALL_PREFIX}/${target_install_dir}/gui-builder")
configure_file("${PROJECT_SOURCE_DIR}/cmake/gui-builder/tgui-gui-builder.desktop.in" "tgui-gui-builder.desktop" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tgui-gui-builder.desktop"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
COMPONENT gui-builder)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/gui-builder/TexusGUI.png"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps"
COMPONENT gui-builder)
endif()

# Add the install rule for the executable
install(TARGETS gui-builder
RUNTIME DESTINATION ${target_install_dir} COMPONENT gui-builder
BUNDLE DESTINATION ${target_install_dir} COMPONENT gui-builder)

# Install the resources next to the gui-builder executable
install(DIRECTORY "${PROJECT_SOURCE_DIR}/gui-builder/resources"
DESTINATION "${target_install_dir}"
COMPONENT gui-builder)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/gui-builder/TexusGUI.png"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps"
install(DIRECTORY "${PROJECT_SOURCE_DIR}/themes"
DESTINATION "${target_install_dir}"
COMPONENT gui-builder)
endif()

# Add the install rule for the executable
install(TARGETS gui-builder
RUNTIME DESTINATION ${target_install_dir} COMPONENT gui-builder
BUNDLE DESTINATION ${target_install_dir} COMPONENT gui-builder)

# Install the resources next to the gui-builder executable
install(DIRECTORY "${PROJECT_SOURCE_DIR}/gui-builder/resources"
DESTINATION "${target_install_dir}"
COMPONENT gui-builder)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/themes"
DESTINATION "${target_install_dir}"
COMPONENT gui-builder)
78 changes: 67 additions & 11 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,74 @@ if(NOT TGUI_BUILD_AS_CXX_MODULE AND NOT TGUI_DISABLE_PRECOMPILED_HEADER)
target_precompile_headers(tgui PRIVATE "${PROJECT_SOURCE_DIR}/include/TGUI/Widget.hpp")
endif()

# Install library
install(TARGETS tgui EXPORT TGUIConfigExport
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bin
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel
FRAMEWORK DESTINATION "." COMPONENT bin
)
if (TGUI_BUILD_FRAMEWORK)
set(config_package_location "TGUI.framework/Resources/CMake")
else()
set(config_package_location ${CMAKE_INSTALL_LIBDIR}/cmake/TGUI)
endif()

# Generate the TGUIConfig.cmake file
# This had to happen here instead of in the root CMakeLists.txt because otherwise it might try to write to the macOS framework before the framework is installed.
# TODO: CMake 3.13 fixed order of installation, so check if the issue still exists.
# Since the config files relies on variables that are only defined in this scope (via the backend include), caution is required when moving this.
if (NOT TGUI_SKIP_EXPORT)
tgui_export_target(TGUIConfigExport)
# TODO: CMake 3.13 fixed order of installation, so check if the issue still exists. Since the config files relies on variables that are only defined in this scope (via the backend include), caution is required when moving this.
include(CMakePackageConfigHelpers)
configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/TGUIConfig.cmake.in"
"${PROJECT_BINARY_DIR}/TGUIConfig.cmake"
INSTALL_DESTINATION "${config_package_location}")

write_basic_package_version_file("${PROJECT_BINARY_DIR}/TGUIConfigVersion.cmake"
VERSION ${TGUI_VERSION_MAJOR}.${TGUI_VERSION_MINOR}.${TGUI_VERSION_PATCH}
COMPATIBILITY SameMajorVersion)

if (TGUI_SHARED_LIBS)
set(targets_config_filename TGUISharedTargets.cmake)
else()
set(targets_config_filename TGUIStaticTargets.cmake)
endif()

if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# When building TGUI alongside its dependencies, the export is only possible when all dependencies also do the export.
# To keep the code simple, we will never create the config file in our build folder when TGUI is build as a subdirectory.
# At the time of writing, the following dependencies have or lack the export call:
# - Have: SFML 2, SDL 3
# - Lack: SDL_ttf, FreeType, GLFW, SFML 3 (https://github.com/SFML/SFML/pull/2619)
export(TARGETS tgui
NAMESPACE TGUI::
FILE "${PROJECT_BINARY_DIR}/${targets_config_filename}")
endif()

if (TGUI_INSTALL)
# Install library
install(TARGETS tgui EXPORT TGUIConfigExport
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT bin
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT devel
FRAMEWORK DESTINATION "." COMPONENT bin)

install(EXPORT TGUIConfigExport
NAMESPACE TGUI::
FILE ${targets_config_filename}
DESTINATION ${config_package_location})

install(FILES "${PROJECT_BINARY_DIR}/TGUIConfig.cmake"
"${PROJECT_BINARY_DIR}/TGUIConfigVersion.cmake"
DESTINATION ${config_package_location}
COMPONENT devel)

# Install the find modules when they are needed to find our dependencies
if(TGUI_HAS_WINDOW_BACKEND_GLFW AND NOT TGUI_FOUND_GLFW_CONFIG)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/Modules/Findglfw3.cmake" DESTINATION ${config_package_location} COMPONENT devel)
add_custom_command(TARGET tgui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/cmake/Modules/Findglfw3.cmake" "${PROJECT_BINARY_DIR}/" VERBATIM)
endif()
if((TGUI_HAS_WINDOW_BACKEND_SDL OR TGUI_HAS_FONT_BACKEND_SDL_TTF) AND NOT TGUI_FOUND_SDL2_CONFIG)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2.cmake" DESTINATION ${config_package_location} COMPONENT devel)
add_custom_command(TARGET tgui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2.cmake" "${PROJECT_BINARY_DIR}/" VERBATIM)
endif()
if(TGUI_HAS_FONT_BACKEND_SDL_TTF AND NOT TGUI_FOUND_SDL2_TTF_CONFIG)
install(FILES "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2_ttf.cmake" DESTINATION ${config_package_location} COMPONENT devel)
add_custom_command(TARGET tgui POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/cmake/Modules/FindSDL2_ttf.cmake" "${PROJECT_BINARY_DIR}/" VERBATIM)
endif()

if (TGUI_INSTALL_PKGCONFIG_FILES)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/tgui.pc" DESTINATION "${TGUI_PKGCONFIG_INSTALL_PREFIX}")
endif()
endif()
32 changes: 17 additions & 15 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,20 @@ if(TGUI_SHARED_LIBS AND TGUI_OS_LINUX)
INSTALL_RPATH "$ORIGIN/${rel_lib_dir}")
endif()

# Add the install rule for the executable
install(TARGETS tests
RUNTIME DESTINATION ${target_install_dir} COMPONENT tests
BUNDLE DESTINATION ${target_install_dir} COMPONENT tests)

# Install the resources next to the test executable
install(DIRECTORY "${PROJECT_SOURCE_DIR}/tests/resources"
DESTINATION "${target_install_dir}"
COMPONENT tests)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/tests/expected"
DESTINATION "${target_install_dir}"
COMPONENT tests)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/themes/"
DESTINATION "${target_install_dir}/resources"
COMPONENT tests)
if (TGUI_INSTALL)
# Add the install rule for the executable
install(TARGETS tests
RUNTIME DESTINATION ${target_install_dir} COMPONENT tests
BUNDLE DESTINATION ${target_install_dir} COMPONENT tests)

# Install the resources next to the test executable
install(DIRECTORY "${PROJECT_SOURCE_DIR}/tests/resources"
DESTINATION "${target_install_dir}"
COMPONENT tests)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/tests/expected"
DESTINATION "${target_install_dir}"
COMPONENT tests)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/themes/"
DESTINATION "${target_install_dir}/resources"
COMPONENT tests)
endif()

0 comments on commit 7f85eb4

Please sign in to comment.