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
)
stage/master/nightly/2021/08/25^2
parent
f64e8036aa
commit
047d46ebdb
|
@ -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"
|
||||
|
|
|
@ -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}"
|
||||
)
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
void shared_hello();
|
||||
#include <shared_lib_export.h>
|
||||
|
||||
void SHARED_LIB_EXPORT shared_hello();
|
||||
|
|
|
@ -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}>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue