summaryrefslogtreecommitdiff
path: root/Tests/InstallMode
diff options
context:
space:
mode:
authorFelix Lelchuk <felix.lelchuk@gmx.de>2021-08-21 13:52:49 +0200
committerFelix Lelchuk <felix.lelchuk@gmx.de>2021-08-24 19:21:40 +0200
commit047d46ebdbb87f0388fa1627a3c39810e0b08c69 (patch)
treec81e2f73673755c7400cdaf6e70d0d93451d5dcf /Tests/InstallMode
parentf64e8036aa1498edc34b1624df9dc8633467e7ef (diff)
downloadcmake-047d46ebdbb87f0388fa1627a3c39810e0b08c69.tar.gz
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')
-rw-r--r--Tests/InstallMode/Subproject.cmake13
-rw-r--r--Tests/InstallMode/subpro_b_shared_lib/CMakeLists.txt11
-rw-r--r--Tests/InstallMode/subpro_b_shared_lib/include/shared_lib.h4
-rw-r--r--Tests/InstallMode/subpro_c_nested_lib/subsubpro_c2_lib/CMakeLists.txt3
-rw-r--r--Tests/InstallMode/subpro_d_executable/CMakeLists.txt3
5 files changed, 24 insertions, 10 deletions
diff --git a/Tests/InstallMode/Subproject.cmake b/Tests/InstallMode/Subproject.cmake
index e4354d67ee..826e61e02d 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 eb118c9a1b..b3d9cb2fe9 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 fd960db019..550b2b44d5 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 e139446edc..7580c778c1 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 9847227573..60189e228a 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