diff options
author | Felix Lelchuk <felix.lelchuk@gmx.de> | 2021-08-21 11:52:49 (GMT) |
---|---|---|
committer | Felix Lelchuk <felix.lelchuk@gmx.de> | 2021-08-24 17:21:40 (GMT) |
commit | 047d46ebdbb87f0388fa1627a3c39810e0b08c69 (patch) | |
tree | c81e2f73673755c7400cdaf6e70d0d93451d5dcf /Tests/InstallMode | |
parent | f64e8036aa1498edc34b1624df9dc8633467e7ef (diff) | |
download | CMake-047d46ebdbb87f0388fa1627a3c39810e0b08c69.zip CMake-047d46ebdbb87f0388fa1627a3c39810e0b08c69.tar.gz CMake-047d46ebdbb87f0388fa1627a3c39810e0b08c69.tar.bz2 |
Fix: InstallMode tests fail on some platforms
1) The ExternalProject_Add() command was called with
UPDATE_COMMAND ";" which was not noticable on most platforms
2) On AIX/GCC, the executable did not link because symbols from
imported libraries were assumed extern "C" (see commit 4fc47424)
Diffstat (limited to 'Tests/InstallMode')
5 files changed, 24 insertions, 10 deletions
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 |