Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
ce0c303d
Commit
ce0c303d
authored
Nov 20, 2012
by
Stephen Kelly
Committed by
Brad King
Oct 07, 2013
Browse files
install: Teach EXPORT option to handle INTERFACE_LIBRARY targets
parent
435c9128
Changes
4
Hide whitespace changes
Inline
Side-by-side
Source/cmExportInstallFileGenerator.cxx
View file @
ce0c303d
...
...
@@ -114,6 +114,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std
::
vector
<
std
::
string
>
missingTargets
;
bool
require2_8_12
=
false
;
bool
require2_8_13
=
false
;
// Create all the imported targets.
for
(
std
::
vector
<
cmTargetExport
*>::
const_iterator
tei
=
allTargets
.
begin
();
...
...
@@ -153,6 +154,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
require2_8_12
=
true
;
}
}
if
(
te
->
GetType
()
==
cmTarget
::
INTERFACE_LIBRARY
)
{
require2_8_13
=
true
;
}
this
->
PopulateInterfaceProperty
(
"INTERFACE_POSITION_INDEPENDENT_CODE"
,
te
,
properties
);
this
->
PopulateCompatibleInterfaceProperties
(
te
,
properties
);
...
...
@@ -160,7 +165,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this
->
GenerateInterfaceProperties
(
te
,
os
,
properties
);
}
if
(
require2_8_12
)
if
(
require2_8_13
)
{
this
->
GenerateRequiredCMakeVersion
(
os
,
"2.8.12.20131007"
);
}
else
if
(
require2_8_12
)
{
this
->
GenerateRequiredCMakeVersion
(
os
,
"2.8.12"
);
}
...
...
@@ -286,6 +295,14 @@ cmExportInstallFileGenerator
cmTargetExport
const
*
te
=
*
tei
;
ImportPropertyMap
properties
;
std
::
set
<
std
::
string
>
importedLocations
;
if
(
!
properties
.
empty
()
&&
te
->
Target
->
GetType
()
==
cmTarget
::
INTERFACE_LIBRARY
)
{
this
->
GenerateImportPropertyCode
(
os
,
config
,
te
->
Target
,
properties
);
this
->
GenerateImportedFileChecksCode
(
os
,
te
->
Target
,
properties
,
importedLocations
);
continue
;
}
this
->
SetImportLocationProperty
(
config
,
suffix
,
te
->
ArchiveGenerator
,
properties
,
importedLocations
);
this
->
SetImportLocationProperty
(
config
,
suffix
,
te
->
LibraryGenerator
,
...
...
Source/cmInstallCommand.cxx
View file @
ce0c303d
...
...
@@ -379,7 +379,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
target
->
GetType
()
!=
cmTarget
::
STATIC_LIBRARY
&&
target
->
GetType
()
!=
cmTarget
::
SHARED_LIBRARY
&&
target
->
GetType
()
!=
cmTarget
::
MODULE_LIBRARY
&&
target
->
GetType
()
!=
cmTarget
::
OBJECT_LIBRARY
)
target
->
GetType
()
!=
cmTarget
::
OBJECT_LIBRARY
&&
target
->
GetType
()
!=
cmTarget
::
INTERFACE_LIBRARY
)
{
cmOStringStream
e
;
e
<<
"TARGETS given target
\"
"
<<
(
*
targetIt
)
...
...
@@ -626,6 +627,11 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
}
}
break
;
case
cmTarget
::
INTERFACE_LIBRARY
:
// Nothing to do. An INTERFACE_LIBRARY can be installed, but the
// only effect of that is to make it exportable. It installs no
// other files itself.
break
;
default:
// This should never happen due to the above type check.
// Ignore the case.
...
...
Tests/ExportImport/Export/Interface/CMakeLists.txt
View file @
ce0c303d
...
...
@@ -27,3 +27,23 @@ export(TARGETS sharediface sharedlib headeronly
NAMESPACE bld_
FILE ../ExportInterfaceBuildTree.cmake
)
install
(
TARGETS headeronly sharediface sharedlib
EXPORT expInterface
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib NAMELINK_SKIP
ARCHIVE DESTINATION lib
FRAMEWORK DESTINATION Frameworks
BUNDLE DESTINATION Applications
)
install
(
FILES
headeronly/headeronly.h
DESTINATION include/headeronly
)
install
(
FILES
sharedlib/sharedlib.h
"
${
CMAKE_CURRENT_BINARY_DIR
}
/sharedlib_export.h"
DESTINATION include/sharedlib
)
install
(
EXPORT expInterface NAMESPACE exp_ DESTINATION lib/exp
)
Tests/ExportImport/Import/Interface/CMakeLists.txt
View file @
ce0c303d
...
...
@@ -2,6 +2,9 @@
# Import targets from the exported build tree.
include
(
${
Import_BINARY_DIR
}
/../Export/ExportInterfaceBuildTree.cmake
)
# Import targets from the exported install tree.
include
(
${
CMAKE_INSTALL_PREFIX
}
/lib/exp/expInterface.cmake
)
add_library
(
define_iface INTERFACE
)
set_property
(
TARGET define_iface PROPERTY
INTERFACE_COMPILE_DEFINITIONS DEFINE_IFACE_DEFINE
)
...
...
@@ -40,3 +43,13 @@ macro(do_try_compile prefix)
endmacro
()
do_try_compile
(
bld_
)
add_executable
(
headeronlytest_exp headeronlytest.cpp
)
target_link_libraries
(
headeronlytest_exp exp_headeronly
)
set_property
(
TARGET exp_sharediface APPEND PROPERTY INTERFACE_LINK_LIBRARIES define_iface
)
add_executable
(
interfacetest_exp interfacetest.cpp
)
target_link_libraries
(
interfacetest_exp exp_sharediface
)
do_try_compile
(
exp_
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment