diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/InstallMode/Subproject.cmake | 13 | ||||
-rw-r--r-- | Tests/InstallMode/subpro_b_shared_lib/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/InstallMode/subpro_b_shared_lib/include/shared_lib.h | 4 | ||||
-rw-r--r-- | Tests/InstallMode/subpro_c_nested_lib/subsubpro_c2_lib/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/InstallMode/subpro_d_executable/CMakeLists.txt | 3 |
6 files changed, 28 insertions, 15 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9dab5b9..76c6c05 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1649,15 +1649,14 @@ if(BUILD_TESTING) DEPENDS ExternalProjectUpdateSetup ) execute_process( - COMMAND ${CMAKE_CMAKE_COMMAND} + COMMAND ${CMAKE_COMMAND} "-E" create_symlink "${CMake_SOURCE_DIR}/Tests/CMakeLists.txt" # random source file that exists "${CMake_BINARY_DIR}/Tests/try_to_create_symlink" # random target file in existing directory - RESULT_VARIABLE _failed + RESULT_VARIABLE _symlink_result ) - if(_failed) - message("Failed to create a simple symlink on this machine. Skipping InstallMode tests.") - else() + if(_symlink_result EQUAL 0) + file(REMOVE "${CMake_BINARY_DIR}/Tests/try_to_create_symlink") function(add_installmode_test _mode) set(ENV{CMAKE_INSTALL_MODE} _mode) set(_maybe_InstallMode_CTEST_OPTIONS) diff --git a/Tests/InstallMode/Subproject.cmake b/Tests/InstallMode/Subproject.cmake index e4354d6..826e61e 100644 --- a/Tests/InstallMode/Subproject.cmake +++ b/Tests/InstallMode/Subproject.cmake @@ -10,12 +10,7 @@ function(add_subproject _name) set(_maybe_NO_INSTALL) if(_arg_NO_INSTALL) - set(_maybe_NO_INSTALL "INSTALL_COMMAND") - else() - # This is a trick to get a valid call. - # Since we set UPDATE_COMMAND to "" - # explicitly below, this won't harm. - set(_maybe_NO_INSTALL "UPDATE_COMMAND") + set(_maybe_NO_INSTALL INSTALL_COMMAND "") endif() if(CMAKE_GENERATOR MATCHES "Ninja Multi-Config") @@ -35,7 +30,9 @@ function(add_subproject _name) ExternalProject_Add("${_name}" DOWNLOAD_COMMAND "" UPDATE_COMMAND "" - ${_maybe_NO_INSTALL} "" + UPDATE_DISCONNECTED ON + + "${_maybe_NO_INSTALL}" BUILD_ALWAYS ON @@ -67,7 +64,7 @@ function(add_subproject _name) # however, we need to explicitly inherit other parent # project's build settings. "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}" - ${_maybe_NINJA_MULTICONFIG_ARGS} + "${_maybe_NINJA_MULTICONFIG_ARGS}" # Subproject progress reports clutter up the output, disable "-DCMAKE_TARGET_MESSAGES:BOOL=OFF" diff --git a/Tests/InstallMode/subpro_b_shared_lib/CMakeLists.txt b/Tests/InstallMode/subpro_b_shared_lib/CMakeLists.txt index eb118c9..b3d9cb2 100644 --- a/Tests/InstallMode/subpro_b_shared_lib/CMakeLists.txt +++ b/Tests/InstallMode/subpro_b_shared_lib/CMakeLists.txt @@ -4,12 +4,18 @@ cmake_minimum_required(VERSION 3.20) project(shared_lib_project VERSION 2.3.4 LANGUAGES CXX) include(GNUInstallDirs) +include(GenerateExportHeader) add_library(the_shared_lib SHARED "include/shared_lib.h" "src/shared_lib.cpp" ) +generate_export_header(the_shared_lib + BASE_NAME shared_lib + EXPORT_FILE_NAME include/shared_lib_export.h +) + set_target_properties(the_shared_lib PROPERTIES VERSION "${PROJECT_VERSION}" @@ -18,11 +24,14 @@ set_target_properties(the_shared_lib target_include_directories(the_shared_lib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) install( - DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" + DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}/include/" + "${CMAKE_CURRENT_BINARY_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) diff --git a/Tests/InstallMode/subpro_b_shared_lib/include/shared_lib.h b/Tests/InstallMode/subpro_b_shared_lib/include/shared_lib.h index fd960db..550b2b4 100644 --- a/Tests/InstallMode/subpro_b_shared_lib/include/shared_lib.h +++ b/Tests/InstallMode/subpro_b_shared_lib/include/shared_lib.h @@ -1,3 +1,5 @@ #pragma once -void shared_hello(); +#include <shared_lib_export.h> + +void SHARED_LIB_EXPORT shared_hello(); diff --git a/Tests/InstallMode/subpro_c_nested_lib/subsubpro_c2_lib/CMakeLists.txt b/Tests/InstallMode/subpro_c_nested_lib/subsubpro_c2_lib/CMakeLists.txt index e139446..7580c77 100644 --- a/Tests/InstallMode/subpro_c_nested_lib/subsubpro_c2_lib/CMakeLists.txt +++ b/Tests/InstallMode/subpro_c_nested_lib/subsubpro_c2_lib/CMakeLists.txt @@ -18,6 +18,9 @@ target_link_libraries(the_c2_lib the_c1_lib ) +# This is to fix an issue on AIX/GCC (see commit 4fc47424) +set_property(TARGET the_c2_lib PROPERTY NO_SYSTEM_FROM_IMPORTED 1) + target_include_directories(the_c2_lib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> diff --git a/Tests/InstallMode/subpro_d_executable/CMakeLists.txt b/Tests/InstallMode/subpro_d_executable/CMakeLists.txt index 9847227..60189e2 100644 --- a/Tests/InstallMode/subpro_d_executable/CMakeLists.txt +++ b/Tests/InstallMode/subpro_d_executable/CMakeLists.txt @@ -17,6 +17,9 @@ target_link_libraries(the_executable PRIVATE the_c2_lib ) +# This is to fix an issue on AIX/GCC (see commit 4fc47424) +set_property(TARGET the_executable PROPERTY NO_SYSTEM_FROM_IMPORTED 1) + install( TARGETS the_executable |