mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 13:19:51 -05:00
Merge topic 'aix-archive-shared-libraries'
2c22aae14bTests/RunCMake: Enable CMP0182 in test cases on AIX5c78623143AIX: Enable shared library archives by default7a05e8e994Help: Reword AIX_SHARED_LIBRARY_ARCHIVE to avoid assuming a default655a245d60Tests: Explicitly disable AIX_SHARED_LIBRARY_ARCHIVE in some cases Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !10030
This commit is contained in:
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.32
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
CMP0182: Create shared library archives by default on AIX. </policy/CMP0182>
|
||||
CMP0181: Link command-line fragment variables are parsed and re-quoted. </policy/CMP0181>
|
||||
|
||||
Policies Introduced by CMake 3.31
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
CMP0182
|
||||
-------
|
||||
|
||||
.. versionadded:: 3.32
|
||||
|
||||
Create shared library archives by default on AIX.
|
||||
|
||||
CMake 3.30 and below always represented ``SHARED`` library targets
|
||||
as plain shared object ``.so`` files. This is consistent with other
|
||||
UNIX platforms, but is not the preferred convention on AIX.
|
||||
CMake 3.31 added the :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE` target
|
||||
property to create a shared library archive: the shared object ``.so``
|
||||
file is placed inside an archive ``.a`` file. However, the behavior
|
||||
was disabled by default for compatibility with existing projects that
|
||||
do not set :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE`.
|
||||
|
||||
CMake 3.32 and above prefer, when :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE`
|
||||
is not set, to enable creation of shared library archives by default
|
||||
because it is the preferred convention on AIX. This policy provides
|
||||
compatibility for projects that have not been updated.
|
||||
|
||||
The ``OLD`` behavior for this policy is to disable shared library
|
||||
archives when :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE` is not set.
|
||||
The ``NEW`` behavior for this policy is to enable shared library
|
||||
archives when :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE` is not set.
|
||||
|
||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.32
|
||||
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
|
||||
.. include:: STANDARD_ADVICE.txt
|
||||
|
||||
.. include:: DEPRECATED.txt
|
||||
@@ -3,20 +3,32 @@ AIX_SHARED_LIBRARY_ARCHIVE
|
||||
|
||||
.. versionadded:: 3.31
|
||||
|
||||
On AIX, enable creation of a shared library archive. This places
|
||||
the shared object ``.so`` file inside an archive ``.a`` file.
|
||||
On AIX, enable or disable creation of a shared library archive
|
||||
for a ``SHARED`` library target:
|
||||
|
||||
By default, CMake creates shared libraries on AIX as plain
|
||||
shared object ``.so`` files for consistency with other UNIX platforms.
|
||||
Alternatively, set this property to a true value to create a shared
|
||||
library archive instead, as is AIX convention.
|
||||
* If enabled, the shared object ``.so`` file is placed inside
|
||||
an archive ``.a`` file. This is the preferred convention on AIX.
|
||||
|
||||
The shared object name in the archive encodes version information from
|
||||
the :prop_tgt:`SOVERSION` target property, if set, and otherwise from
|
||||
the :prop_tgt:`VERSION` target property, if set.
|
||||
The shared object name in the archive encodes version information from
|
||||
the :prop_tgt:`SOVERSION` target property, if set, and otherwise from
|
||||
the :prop_tgt:`VERSION` target property, if set.
|
||||
|
||||
* If disabled, a plain shared object ``.so`` file is produced.
|
||||
This is consistent with other UNIX platforms.
|
||||
|
||||
This property defaults to :variable:`CMAKE_AIX_SHARED_LIBRARY_ARCHIVE`
|
||||
if that variable is set when a non-imported ``SHARED`` library target
|
||||
is created by :command:`add_library`. Imported targets must explicitly
|
||||
enable :prop_tgt:`!AIX_SHARED_LIBRARY_ARCHIVE` if they import an AIX
|
||||
shared library archive.
|
||||
|
||||
.. versionchanged:: 3.32
|
||||
|
||||
For a non-imported target, if this property is not set, the
|
||||
default is *enabled*. See policy :policy:`CMP0182`.
|
||||
|
||||
In CMake 3.31, policy :policy:`CMP0182` did not exist,
|
||||
so the default was *disabled*.
|
||||
|
||||
In CMake 3.30 and lower, :prop_tgt:`!AIX_SHARED_LIBRARY_ARCHIVE`
|
||||
did not exist, so the default was *disabled*.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
aix-archive-shared-libraries
|
||||
----------------------------
|
||||
|
||||
* On AIX, ``SHARED`` library targets now produce a shared library archive
|
||||
by default. See policy :policy:`CMP0182`.
|
||||
@@ -3,7 +3,7 @@ CMAKE_AIX_SHARED_LIBRARY_ARCHIVE
|
||||
|
||||
.. versionadded:: 3.31
|
||||
|
||||
On AIX, enable creation of shared library archives.
|
||||
On AIX, enable or disable creation of shared library archives.
|
||||
|
||||
This variable initializes the :prop_tgt:`AIX_SHARED_LIBRARY_ARCHIVE`
|
||||
target property on non-imported ``SHARED`` library targets as they are
|
||||
|
||||
+5
-2
@@ -548,7 +548,9 @@ class cmMakefile;
|
||||
31, 0, WARN) \
|
||||
SELECT(POLICY, CMP0181, \
|
||||
"Link command-line fragment variables are parsed and re-quoted.", 3, \
|
||||
32, 0, WARN)
|
||||
32, 0, WARN) \
|
||||
SELECT(POLICY, CMP0182, \
|
||||
"Create shared library archives by default on AIX.", 3, 32, 0, WARN)
|
||||
|
||||
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
|
||||
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
||||
@@ -594,7 +596,8 @@ class cmMakefile;
|
||||
F(CMP0160) \
|
||||
F(CMP0162) \
|
||||
F(CMP0179) \
|
||||
F(CMP0181)
|
||||
F(CMP0181) \
|
||||
F(CMP0182)
|
||||
|
||||
#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
|
||||
F(CMP0116) \
|
||||
|
||||
+19
-2
@@ -1307,8 +1307,25 @@ bool cmTarget::IsFrameworkOnApple() const
|
||||
|
||||
bool cmTarget::IsArchivedAIXSharedLibrary() const
|
||||
{
|
||||
return (this->GetType() == cmStateEnums::SHARED_LIBRARY && this->IsAIX() &&
|
||||
this->GetPropertyAsBool("AIX_SHARED_LIBRARY_ARCHIVE"));
|
||||
if (this->GetType() == cmStateEnums::SHARED_LIBRARY && this->IsAIX()) {
|
||||
cmValue value = this->GetProperty("AIX_SHARED_LIBRARY_ARCHIVE");
|
||||
if (!value.IsEmpty()) {
|
||||
return value.IsOn();
|
||||
}
|
||||
if (this->IsImported()) {
|
||||
return false;
|
||||
}
|
||||
switch (this->GetPolicyStatusCMP0182()) {
|
||||
case cmPolicies::WARN:
|
||||
case cmPolicies::OLD:
|
||||
// The OLD behavior's default is to disable shared library archives.
|
||||
break;
|
||||
case cmPolicies::NEW:
|
||||
// The NEW behavior's default is to enable shared library archives.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cmTarget::IsAppBundleOnApple() const
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
project(PerConfig C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
# Targets with per-configuration names.
|
||||
add_library(pcStatic STATIC pcStatic.c)
|
||||
set_property(TARGET pcStatic PROPERTY RELEASE_POSTFIX -opt)
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 43,
|
||||
"line": 45,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -96,7 +96,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -144,7 +144,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -189,7 +189,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -233,7 +233,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -277,7 +277,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 51,
|
||||
"line": 53,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -324,7 +324,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 53,
|
||||
"line": 55,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -369,7 +369,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 54,
|
||||
"line": 56,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -418,7 +418,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 55,
|
||||
"line": 57,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -470,7 +470,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 56,
|
||||
"line": 58,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -519,7 +519,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 57,
|
||||
"line": 59,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -561,7 +561,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 58,
|
||||
"line": 60,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -603,7 +603,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 59,
|
||||
"line": 61,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 6,
|
||||
"line": 8,
|
||||
"command": "add_executable",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -64,7 +64,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 6,
|
||||
"line": 8,
|
||||
"command": "add_executable",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -114,7 +114,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 7,
|
||||
"line": 9,
|
||||
"command": "target_link_libraries",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 5,
|
||||
"line": 7,
|
||||
"command": "add_library",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -64,7 +64,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 5,
|
||||
"line": 7,
|
||||
"command": "add_library",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 10,
|
||||
"line": 12,
|
||||
"command": "add_executable",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -64,7 +64,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 10,
|
||||
"line": 12,
|
||||
"command": "add_executable",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -114,7 +114,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 11,
|
||||
"line": 13,
|
||||
"command": "target_link_libraries",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 9,
|
||||
"line": 11,
|
||||
"command": "add_library",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -69,7 +69,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 9,
|
||||
"line": 11,
|
||||
"command": "add_library",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -118,7 +118,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -148,7 +148,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -178,7 +178,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 51,
|
||||
"line": 53,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 14,
|
||||
"line": 16,
|
||||
"command": "add_executable",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -64,7 +64,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 14,
|
||||
"line": 16,
|
||||
"command": "add_executable",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -114,7 +114,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 15,
|
||||
"line": 17,
|
||||
"command": "target_link_libraries",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 13,
|
||||
"line": 15,
|
||||
"command": "add_library",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -64,7 +64,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 13,
|
||||
"line": 15,
|
||||
"command": "add_library",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 17,
|
||||
"line": 19,
|
||||
"command": "add_library",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 43,
|
||||
"line": 45,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -124,7 +124,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 46,
|
||||
"line": 48,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -154,7 +154,7 @@
|
||||
"backtrace": [
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 51,
|
||||
"line": 53,
|
||||
"command": "install",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 3,
|
||||
"line": 5,
|
||||
"command": "include",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -91,7 +91,7 @@
|
||||
},
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 3,
|
||||
"line": 5,
|
||||
"command": "include",
|
||||
"hasParent": true
|
||||
},
|
||||
@@ -134,7 +134,7 @@
|
||||
},
|
||||
{
|
||||
"file": "^codemodel-v2\\.cmake$",
|
||||
"line": 3,
|
||||
"line": 5,
|
||||
"command": "include",
|
||||
"hasParent": true
|
||||
},
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/include_test.cmake")
|
||||
|
||||
add_library(c_lib empty.c)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language (C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
set (win_platforms Windows CYGWIN MSYS)
|
||||
|
||||
set (GENERATE_CONTENT [[
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language (C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
set (win_platforms Windows CYGWIN MSYS)
|
||||
|
||||
set (GENERATE_CONTENT [[
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
set (GENERATE_CONTENT [[
|
||||
macro (CHECK_VALUE test_msg value expected)
|
||||
if (NOT "${value}" STREQUAL "${expected}")
|
||||
|
||||
@@ -113,6 +113,9 @@ function(run_cmake test)
|
||||
if(RunCMake_TEST_LCC AND NOT RunCMake_TEST_NO_CMP0129)
|
||||
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0129=NEW)
|
||||
endif()
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "AIX")
|
||||
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0182=NEW)
|
||||
endif()
|
||||
if(RunCMake_MAKE_PROGRAM)
|
||||
list(APPEND RunCMake_TEST_OPTIONS "-DCMAKE_MAKE_PROGRAM=${RunCMake_MAKE_PROGRAM}")
|
||||
endif()
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
\* CMP0162
|
||||
\* CMP0179
|
||||
\* CMP0181
|
||||
\* CMP0182
|
||||
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
add_executable(exe main.c)
|
||||
add_library(lib1 SHARED obj1.c)
|
||||
set_property(TARGET lib1 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj3.h)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
add_executable(exe main.c)
|
||||
add_library(lib1 SHARED obj1.c)
|
||||
set_property(TARGET lib1 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj3.h)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
macro(add_versioned_library NAME)
|
||||
add_library(${NAME} SHARED obj1.c)
|
||||
set_target_properties(${NAME} PROPERTIES
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
add_executable(test1 main.c)
|
||||
set_property(TARGET test1 PROPERTY OUTPUT_NAME test1out)
|
||||
set_property(TARGET test1 PROPERTY RELEASE_OUTPUT_NAME test1rel)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
add_library (func SHARED func.c)
|
||||
|
||||
set (binary_dir "${CMAKE_BINARY_DIR}")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
# ensure command line is always displayed and do not use any response file
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
set(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES FALSE)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0)
|
||||
|
||||
if(CMP0156 STREQUAL "NEW")
|
||||
cmake_policy(SET CMP0156 NEW)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LIBRARIES_PROCESSING.cmake" "set(CMAKE_C_LINK_LIBRARIES_PROCESSING \"${CMAKE_C_LINK_LIBRARIES_PROCESSING}\")\n")
|
||||
|
||||
@@ -42,3 +42,24 @@ get_property(aix_sla TARGET imported PROPERTY AIX_SHARED_LIBRARY_ARCHIVE)
|
||||
if(aix_sla)
|
||||
message(FATAL_ERROR "AIX_SHARED_LIBRARY_ARCHIVE initialized on imported target")
|
||||
endif()
|
||||
|
||||
unset(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE)
|
||||
cmake_policy(SET CMP0182 NEW)
|
||||
|
||||
add_library(sla_CMP0182 SHARED sla.c)
|
||||
get_property(aix_sla_CMP0182 TARGET sla_CMP0182 PROPERTY AIX_SHARED_LIBRARY_ARCHIVE)
|
||||
if(aix_sla_CMP0182)
|
||||
message(FATAL_ERROR "AIX_SHARED_LIBRARY_ARCHIVE initialized without CMAKE_AIX_SHARED_LIBRARY_ARCHIVE")
|
||||
endif()
|
||||
add_custom_command(TARGET sla_CMP0182 POST_BUILD VERBATIM
|
||||
COMMAND ${CMAKE_COMMAND} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -Dsla=$<TARGET_FILE:sla_CMP0182> -Dname=sla_CMP0182 -Dsoversion= -P${CMAKE_CURRENT_SOURCE_DIR}/sla-check.cmake
|
||||
)
|
||||
|
||||
add_executable(UseSLA_CMP0182 use_sla.c)
|
||||
target_link_libraries(UseSLA_CMP0182 PRIVATE sla_CMP0182)
|
||||
|
||||
add_library(nosla_CMP0182 SHARED sla.c)
|
||||
set_property(TARGET nosla_CMP0182 PROPERTY AIX_SHARED_LIBRARY_ARCHIVE OFF)
|
||||
add_custom_command(TARGET nosla_CMP0182 POST_BUILD VERBATIM
|
||||
COMMAND ${CMAKE_COMMAND} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -Dnosla=$<TARGET_FILE:nosla_CMP0182> -Dname=nosla_CMP0182 -P${CMAKE_CURRENT_SOURCE_DIR}/nosla-check.cmake
|
||||
)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
|
||||
set(nosla_regex "/lib${name}\\.so$")
|
||||
if(NOT nosla MATCHES "${nosla_regex}")
|
||||
message(FATAL_ERROR "nosla library does not look like a shared object:\n ${nosla}")
|
||||
endif()
|
||||
endif()
|
||||
Reference in New Issue
Block a user