summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-05-16 18:19:22 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-19 13:06:20 (GMT)
commit42bbf1307a927e19f1ac937b14301e878370c6b6 (patch)
treef2b99c53e70c23107c97e384ea289d336f5d8c57
parent61856c8011bf7d14712cdad3842d177a002fd3ee (diff)
downloadCMake-42bbf1307a927e19f1ac937b14301e878370c6b6.zip
CMake-42bbf1307a927e19f1ac937b14301e878370c6b6.tar.gz
CMake-42bbf1307a927e19f1ac937b14301e878370c6b6.tar.bz2
CMP0022: Fix link language propagation in NEW behavior
The languages used in compiling STATIC libraries need to be propagated to dependents regardless of the settings of INTERFACE_LINK_LIBRARIES or CMP0022. They are independent of the libraries in the link interface. Prior to commit v2.8.12~192^2~2 (Introduce the INTERFACE_LINK_LIBRARIES property, 2013-06-04) the cmTarget::ComputeLinkInterface code path for "explicitLibraries" could never be taken for STATIC libraries, so the logic to propagate languages existed only in the non-explicitLibraries code path. After that commit, INTERFACE_LINK_LIBRARIES could be set for STATIC libraries to cause the "explicitLibraries" code path to be taken. The commit also left the old non-explicitLibraries code path conditional on CMP0022 not being set to NEW. Thus link language propagation was left missing from two cases by that commit. The explicitLibraries code path was fixed to propagate languages by commit v2.8.12~149^2~1 (cmTarget: Fix iface libraries and languages for static libraries, 2013-07-26). However, the non-explicitLibraries case was never taught to propagate languages when CMP0022 is set to NEW. Fix that now. Factor the logic to propagate link languages out of the link interface libraries conditions so that it always occurs. Update Tests/Fortran to set CMP0022 to NEW to test this case (because the test passes only if link language propagation works).
-rw-r--r--Source/cmTarget.cxx14
-rw-r--r--Tests/Fortran/CMakeLists.txt2
2 files changed, 8 insertions, 8 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 3f2ae9e..a243de5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -6481,11 +6481,6 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
}
}
}
- if(thisTarget->LinkLanguagePropagatesToDependents())
- {
- // Targets using this archive need its language runtime libraries.
- iface.Languages = impl->Languages;
- }
}
}
}
@@ -6497,9 +6492,14 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
impl = thisTarget->GetLinkImplementation(config, headTarget);
iface.ImplementationIsInterface = true;
iface.WrongConfigLibraries = impl->WrongConfigLibraries;
- if(thisTarget->LinkLanguagePropagatesToDependents())
+ }
+
+ if(thisTarget->LinkLanguagePropagatesToDependents())
+ {
+ // Targets using this archive need its language runtime libraries.
+ if(cmTarget::LinkImplementation const* impl =
+ thisTarget->GetLinkImplementation(config, headTarget))
{
- // Targets using this archive need its language runtime libraries.
iface.Languages = impl->Languages;
}
}
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index bf6d629..ef3b317 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 3.0)
project(testf C CXX Fortran)
if(NOT DEFINED CMake_TEST_NESTED_MAKE_PROGRAM AND NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMake_TEST_NESTED_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}")