How to export/import MacOS framework with cmake 3.14How to check for an active Internet connection on iOS or macOS?How to “add existing frameworks” in Xcode 4?How to find specific/local files via CMakeHow do I install pip on macOS or OS X?CMake: importing a static lib target and all the libs it depends onOS X Framework Library not loaded: 'Image not found'How to setup cmake library project with export to be consumed by other cmake projectsHow to connect the QuaZip library in CMakeIntended use case for CMake’s export() commandCmake: make static library and use in other projects
Tear out when plate making w/ a router
Writing a love interest for my hero
2.5 year old daughter refuses to take medicine
Character theory and Quantum Chemistry
How should we understand "unobscured by flying friends" in this context?
Gas pipes - why does gas burn "outwards?"
Is the space of Radon measures a Polish space or at least separable?
What does the question of my colleagues really mean?
Is there a star over my head?
Wrathful Smite, and the term 'Creature'
Can a magnet rip protons from a nucleus?
How flexible are number-of-pages submission guidelines for conferences?
I see your BIDMAS and raise you a BADMIS
Job offer without any details but asking me to withdraw other applications - is it normal?
Why would "an mule" be used instead of "a mule"?
I changed a word from a source, how do I cite it correctly?
Where does the expression "triple-A" comes from?
Guitar beginner - What does this card show?
Does the mana ability restriction of Pithing Needle refer to the cost or the effect of an activated ability?
Random point on a sphere
How do I preserve the line ordering for two "equal" strings while sorting and ignoring the case?
Is English tonal for some words, like "permit"?
Why is the the worst case for this function O(n^2)?
Is it appropriate for a professor to require students to sign a non-disclosure agreement before being taught?
How to export/import MacOS framework with cmake 3.14
How to check for an active Internet connection on iOS or macOS?How to “add existing frameworks” in Xcode 4?How to find specific/local files via CMakeHow do I install pip on macOS or OS X?CMake: importing a static lib target and all the libs it depends onOS X Framework Library not loaded: 'Image not found'How to setup cmake library project with export to be consumed by other cmake projectsHow to connect the QuaZip library in CMakeIntended use case for CMake’s export() commandCmake: make static library and use in other projects
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to link a framework, that I made myself called VideoCapturer, to another project through its VideoCapturerConfig.cmake.
But I can't get the "usage requirement" / "target_link_libraries" correctly.
When I give the full path, hardcoded, to the location of the install framework, it works!
target_link_libraries( myprojectA
PUBLIC -framework /install/path/to/videocapturer.framework )
I would rather do that with a target provided by find_package() for more robustness.
Here is the piece of CMake I wrote to build and install the framework
# MyVideoCapturer framework
project( MyVideoCapturer )
### General variables
set( myvideocapturer_targets_export_name "$CMAKE_PROJECT_NAMETargets" )
set( myvideocapturer_config_install_dir "$CMAKE_INSTALL_LIBDIR/cmake/$CMAKE_PROJECT_NAME" )
set( myvideocapturer_project_config "$CMAKE_PROJECT_NAMEConfig.cmake" )
set( myvideocapturer_version_config "$CMAKE_PROJECT_NAMEConfigVersion.cmake" )
add_library( VideoCapturer "" )
add_library( MyVideoCapturer::VideoCapturer ALIAS VideoCapturer )
add_subdirectory( src ) # Mostly target_sources( VideoCapturer PRIVATE someSrcFiles.cpp )
list( APPEND _pubheaders "macVideoCapturer/VideoCapturer.h" )
set_target_properties( VideoCapturer PROPERTIES
FRAMEWORK TRUE
PUBLIC_HEADER "$_pubheaders"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
)
### Install targets, headers and export
include( GNUInstallDirs )
install(
TARGETS VideoCapturer
EXPORT "$myvideocapturer_targets_export_name"
FRAMEWORK DESTINATION $CMAKE_INSTALL_LIBDIR
PUBLIC_HEADER DESTINATION $CMAKE_INSTALL_INCLUDEDIR
)
install(
EXPORT "$myvideocapturer_targets_export_name"
DESTINATION "$myvideocapturer_config_install_dir"
NAMESPACE MyVideoCapturer::
FILE $myvideocapturer_targets_export_name.cmake
)
### Config file for Packaging
include( CMakePackageConfigHelpers )
configure_package_config_file(
"Config.cmake.in"
"$myvideocapturer_project_config"
INSTALL_DESTINATION $myvideocapturer_config_install_dir
PATH_VARS
myvideocapturer_config_install_dir
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
in my Config.cmake.in
@PACKAGE_INIT@
include( "$CMAKE_CURRENT_LIST_DIR/@myvideocapturer_targets_export_name@.cmake" )
After installation of that framework :
in MyVideoCapturerTargets.cmake :
# Create imported target CppMacVideoCapturer::VideoCapturer
add_library(CppMacVideoCapturer::VideoCapturer SHARED IMPORTED)
set_property(TARGET CppMacVideoCapturer::VideoCapturer PROPERTY FRAMEWORK 1)
to my understanding, 2 lines should be enough to get it right :
find_package( myvideocapturer REQUIRED )
target_link_libraries( myprojectA
PUBLIC -framework videocapturer )
when I try that, the project can't find the headers located in Videocapturer.framework/Headers
and if I try :
target_link_libraries( myprojectA
PUBLIC -framework MyVideoCapturer::myvideocapturer )
CMake doesn't find the target.
Any idea how can I export my framework ?
Thanks a lot
EDIT
Thanks to tsyvarev I found a way to solve it. I am not sure if this is the "proper" way to do it though.
In the base project :
if( APPLE )
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
else() # Framework is Apple-only
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_INCLUDEDIR>
)
endif()
EDIT 1/4/19 : the right way seems to do :
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
last edit : Please read my own answer
macos cmake frameworks
add a comment |
I want to link a framework, that I made myself called VideoCapturer, to another project through its VideoCapturerConfig.cmake.
But I can't get the "usage requirement" / "target_link_libraries" correctly.
When I give the full path, hardcoded, to the location of the install framework, it works!
target_link_libraries( myprojectA
PUBLIC -framework /install/path/to/videocapturer.framework )
I would rather do that with a target provided by find_package() for more robustness.
Here is the piece of CMake I wrote to build and install the framework
# MyVideoCapturer framework
project( MyVideoCapturer )
### General variables
set( myvideocapturer_targets_export_name "$CMAKE_PROJECT_NAMETargets" )
set( myvideocapturer_config_install_dir "$CMAKE_INSTALL_LIBDIR/cmake/$CMAKE_PROJECT_NAME" )
set( myvideocapturer_project_config "$CMAKE_PROJECT_NAMEConfig.cmake" )
set( myvideocapturer_version_config "$CMAKE_PROJECT_NAMEConfigVersion.cmake" )
add_library( VideoCapturer "" )
add_library( MyVideoCapturer::VideoCapturer ALIAS VideoCapturer )
add_subdirectory( src ) # Mostly target_sources( VideoCapturer PRIVATE someSrcFiles.cpp )
list( APPEND _pubheaders "macVideoCapturer/VideoCapturer.h" )
set_target_properties( VideoCapturer PROPERTIES
FRAMEWORK TRUE
PUBLIC_HEADER "$_pubheaders"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
)
### Install targets, headers and export
include( GNUInstallDirs )
install(
TARGETS VideoCapturer
EXPORT "$myvideocapturer_targets_export_name"
FRAMEWORK DESTINATION $CMAKE_INSTALL_LIBDIR
PUBLIC_HEADER DESTINATION $CMAKE_INSTALL_INCLUDEDIR
)
install(
EXPORT "$myvideocapturer_targets_export_name"
DESTINATION "$myvideocapturer_config_install_dir"
NAMESPACE MyVideoCapturer::
FILE $myvideocapturer_targets_export_name.cmake
)
### Config file for Packaging
include( CMakePackageConfigHelpers )
configure_package_config_file(
"Config.cmake.in"
"$myvideocapturer_project_config"
INSTALL_DESTINATION $myvideocapturer_config_install_dir
PATH_VARS
myvideocapturer_config_install_dir
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
in my Config.cmake.in
@PACKAGE_INIT@
include( "$CMAKE_CURRENT_LIST_DIR/@myvideocapturer_targets_export_name@.cmake" )
After installation of that framework :
in MyVideoCapturerTargets.cmake :
# Create imported target CppMacVideoCapturer::VideoCapturer
add_library(CppMacVideoCapturer::VideoCapturer SHARED IMPORTED)
set_property(TARGET CppMacVideoCapturer::VideoCapturer PROPERTY FRAMEWORK 1)
to my understanding, 2 lines should be enough to get it right :
find_package( myvideocapturer REQUIRED )
target_link_libraries( myprojectA
PUBLIC -framework videocapturer )
when I try that, the project can't find the headers located in Videocapturer.framework/Headers
and if I try :
target_link_libraries( myprojectA
PUBLIC -framework MyVideoCapturer::myvideocapturer )
CMake doesn't find the target.
Any idea how can I export my framework ?
Thanks a lot
EDIT
Thanks to tsyvarev I found a way to solve it. I am not sure if this is the "proper" way to do it though.
In the base project :
if( APPLE )
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
else() # Framework is Apple-only
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_INCLUDEDIR>
)
endif()
EDIT 1/4/19 : the right way seems to do :
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
last edit : Please read my own answer
macos cmake frameworks
"the project can't find the headers" - Not sure about framworks, but for normal libraries you should use target_include_directories in the base project, and provide$<INSTALL_INTERFACE:>
for your framework. By itself,PUBLIC_HEADER
just mark given header as public, but do not adjust include directory.
– Tsyvarev
Mar 28 at 10:06
All right! Thanks a lot. My mind was set on having this only valid value for the base project : $<INSTALL_INTERFACE:include>; which is incorrect for a framework. I tried to play with generator expression to have something flexible,but the evaluation inside INSTALL_INTERFACE is tricky. Something like this doesnt work: $<INSTALL_INTERFACE:$<IF:$<TARGET_PROPERTY:VideoCapturer,FRAMEWORK>,$<TARGET_FILE_NAME:VideoCapturer>.framework/Headers,include>> so I ended up doing: target_include_directories( VideoCapturer PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework/Headers> )
– Alkalyne
Mar 29 at 7:57
1
No needs to use generator expressions for every condition. Plainif()
is much simpler in many cases. Generator expressions are intended to check features, which may depend on configuration type in multiconfiguration generators. That is, these features may be not known at configuration stage, whenCMakeLists.txt
code is executed. But target platform is always known during configuration. So you may freely useif(MACOS)
for Macos-specific stuff.
– Tsyvarev
Mar 29 at 8:00
add a comment |
I want to link a framework, that I made myself called VideoCapturer, to another project through its VideoCapturerConfig.cmake.
But I can't get the "usage requirement" / "target_link_libraries" correctly.
When I give the full path, hardcoded, to the location of the install framework, it works!
target_link_libraries( myprojectA
PUBLIC -framework /install/path/to/videocapturer.framework )
I would rather do that with a target provided by find_package() for more robustness.
Here is the piece of CMake I wrote to build and install the framework
# MyVideoCapturer framework
project( MyVideoCapturer )
### General variables
set( myvideocapturer_targets_export_name "$CMAKE_PROJECT_NAMETargets" )
set( myvideocapturer_config_install_dir "$CMAKE_INSTALL_LIBDIR/cmake/$CMAKE_PROJECT_NAME" )
set( myvideocapturer_project_config "$CMAKE_PROJECT_NAMEConfig.cmake" )
set( myvideocapturer_version_config "$CMAKE_PROJECT_NAMEConfigVersion.cmake" )
add_library( VideoCapturer "" )
add_library( MyVideoCapturer::VideoCapturer ALIAS VideoCapturer )
add_subdirectory( src ) # Mostly target_sources( VideoCapturer PRIVATE someSrcFiles.cpp )
list( APPEND _pubheaders "macVideoCapturer/VideoCapturer.h" )
set_target_properties( VideoCapturer PROPERTIES
FRAMEWORK TRUE
PUBLIC_HEADER "$_pubheaders"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
)
### Install targets, headers and export
include( GNUInstallDirs )
install(
TARGETS VideoCapturer
EXPORT "$myvideocapturer_targets_export_name"
FRAMEWORK DESTINATION $CMAKE_INSTALL_LIBDIR
PUBLIC_HEADER DESTINATION $CMAKE_INSTALL_INCLUDEDIR
)
install(
EXPORT "$myvideocapturer_targets_export_name"
DESTINATION "$myvideocapturer_config_install_dir"
NAMESPACE MyVideoCapturer::
FILE $myvideocapturer_targets_export_name.cmake
)
### Config file for Packaging
include( CMakePackageConfigHelpers )
configure_package_config_file(
"Config.cmake.in"
"$myvideocapturer_project_config"
INSTALL_DESTINATION $myvideocapturer_config_install_dir
PATH_VARS
myvideocapturer_config_install_dir
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
in my Config.cmake.in
@PACKAGE_INIT@
include( "$CMAKE_CURRENT_LIST_DIR/@myvideocapturer_targets_export_name@.cmake" )
After installation of that framework :
in MyVideoCapturerTargets.cmake :
# Create imported target CppMacVideoCapturer::VideoCapturer
add_library(CppMacVideoCapturer::VideoCapturer SHARED IMPORTED)
set_property(TARGET CppMacVideoCapturer::VideoCapturer PROPERTY FRAMEWORK 1)
to my understanding, 2 lines should be enough to get it right :
find_package( myvideocapturer REQUIRED )
target_link_libraries( myprojectA
PUBLIC -framework videocapturer )
when I try that, the project can't find the headers located in Videocapturer.framework/Headers
and if I try :
target_link_libraries( myprojectA
PUBLIC -framework MyVideoCapturer::myvideocapturer )
CMake doesn't find the target.
Any idea how can I export my framework ?
Thanks a lot
EDIT
Thanks to tsyvarev I found a way to solve it. I am not sure if this is the "proper" way to do it though.
In the base project :
if( APPLE )
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
else() # Framework is Apple-only
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_INCLUDEDIR>
)
endif()
EDIT 1/4/19 : the right way seems to do :
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
last edit : Please read my own answer
macos cmake frameworks
I want to link a framework, that I made myself called VideoCapturer, to another project through its VideoCapturerConfig.cmake.
But I can't get the "usage requirement" / "target_link_libraries" correctly.
When I give the full path, hardcoded, to the location of the install framework, it works!
target_link_libraries( myprojectA
PUBLIC -framework /install/path/to/videocapturer.framework )
I would rather do that with a target provided by find_package() for more robustness.
Here is the piece of CMake I wrote to build and install the framework
# MyVideoCapturer framework
project( MyVideoCapturer )
### General variables
set( myvideocapturer_targets_export_name "$CMAKE_PROJECT_NAMETargets" )
set( myvideocapturer_config_install_dir "$CMAKE_INSTALL_LIBDIR/cmake/$CMAKE_PROJECT_NAME" )
set( myvideocapturer_project_config "$CMAKE_PROJECT_NAMEConfig.cmake" )
set( myvideocapturer_version_config "$CMAKE_PROJECT_NAMEConfigVersion.cmake" )
add_library( VideoCapturer "" )
add_library( MyVideoCapturer::VideoCapturer ALIAS VideoCapturer )
add_subdirectory( src ) # Mostly target_sources( VideoCapturer PRIVATE someSrcFiles.cpp )
list( APPEND _pubheaders "macVideoCapturer/VideoCapturer.h" )
set_target_properties( VideoCapturer PROPERTIES
FRAMEWORK TRUE
PUBLIC_HEADER "$_pubheaders"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
)
### Install targets, headers and export
include( GNUInstallDirs )
install(
TARGETS VideoCapturer
EXPORT "$myvideocapturer_targets_export_name"
FRAMEWORK DESTINATION $CMAKE_INSTALL_LIBDIR
PUBLIC_HEADER DESTINATION $CMAKE_INSTALL_INCLUDEDIR
)
install(
EXPORT "$myvideocapturer_targets_export_name"
DESTINATION "$myvideocapturer_config_install_dir"
NAMESPACE MyVideoCapturer::
FILE $myvideocapturer_targets_export_name.cmake
)
### Config file for Packaging
include( CMakePackageConfigHelpers )
configure_package_config_file(
"Config.cmake.in"
"$myvideocapturer_project_config"
INSTALL_DESTINATION $myvideocapturer_config_install_dir
PATH_VARS
myvideocapturer_config_install_dir
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
in my Config.cmake.in
@PACKAGE_INIT@
include( "$CMAKE_CURRENT_LIST_DIR/@myvideocapturer_targets_export_name@.cmake" )
After installation of that framework :
in MyVideoCapturerTargets.cmake :
# Create imported target CppMacVideoCapturer::VideoCapturer
add_library(CppMacVideoCapturer::VideoCapturer SHARED IMPORTED)
set_property(TARGET CppMacVideoCapturer::VideoCapturer PROPERTY FRAMEWORK 1)
to my understanding, 2 lines should be enough to get it right :
find_package( myvideocapturer REQUIRED )
target_link_libraries( myprojectA
PUBLIC -framework videocapturer )
when I try that, the project can't find the headers located in Videocapturer.framework/Headers
and if I try :
target_link_libraries( myprojectA
PUBLIC -framework MyVideoCapturer::myvideocapturer )
CMake doesn't find the target.
Any idea how can I export my framework ?
Thanks a lot
EDIT
Thanks to tsyvarev I found a way to solve it. I am not sure if this is the "proper" way to do it though.
In the base project :
if( APPLE )
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
else() # Framework is Apple-only
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_INCLUDEDIR>
)
endif()
EDIT 1/4/19 : the right way seems to do :
target_include_directories( VideoCapturer
PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework>
)
last edit : Please read my own answer
macos cmake frameworks
macos cmake frameworks
edited May 8 at 6:11
Alkalyne
asked Mar 28 at 7:44
AlkalyneAlkalyne
564 bronze badges
564 bronze badges
"the project can't find the headers" - Not sure about framworks, but for normal libraries you should use target_include_directories in the base project, and provide$<INSTALL_INTERFACE:>
for your framework. By itself,PUBLIC_HEADER
just mark given header as public, but do not adjust include directory.
– Tsyvarev
Mar 28 at 10:06
All right! Thanks a lot. My mind was set on having this only valid value for the base project : $<INSTALL_INTERFACE:include>; which is incorrect for a framework. I tried to play with generator expression to have something flexible,but the evaluation inside INSTALL_INTERFACE is tricky. Something like this doesnt work: $<INSTALL_INTERFACE:$<IF:$<TARGET_PROPERTY:VideoCapturer,FRAMEWORK>,$<TARGET_FILE_NAME:VideoCapturer>.framework/Headers,include>> so I ended up doing: target_include_directories( VideoCapturer PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework/Headers> )
– Alkalyne
Mar 29 at 7:57
1
No needs to use generator expressions for every condition. Plainif()
is much simpler in many cases. Generator expressions are intended to check features, which may depend on configuration type in multiconfiguration generators. That is, these features may be not known at configuration stage, whenCMakeLists.txt
code is executed. But target platform is always known during configuration. So you may freely useif(MACOS)
for Macos-specific stuff.
– Tsyvarev
Mar 29 at 8:00
add a comment |
"the project can't find the headers" - Not sure about framworks, but for normal libraries you should use target_include_directories in the base project, and provide$<INSTALL_INTERFACE:>
for your framework. By itself,PUBLIC_HEADER
just mark given header as public, but do not adjust include directory.
– Tsyvarev
Mar 28 at 10:06
All right! Thanks a lot. My mind was set on having this only valid value for the base project : $<INSTALL_INTERFACE:include>; which is incorrect for a framework. I tried to play with generator expression to have something flexible,but the evaluation inside INSTALL_INTERFACE is tricky. Something like this doesnt work: $<INSTALL_INTERFACE:$<IF:$<TARGET_PROPERTY:VideoCapturer,FRAMEWORK>,$<TARGET_FILE_NAME:VideoCapturer>.framework/Headers,include>> so I ended up doing: target_include_directories( VideoCapturer PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework/Headers> )
– Alkalyne
Mar 29 at 7:57
1
No needs to use generator expressions for every condition. Plainif()
is much simpler in many cases. Generator expressions are intended to check features, which may depend on configuration type in multiconfiguration generators. That is, these features may be not known at configuration stage, whenCMakeLists.txt
code is executed. But target platform is always known during configuration. So you may freely useif(MACOS)
for Macos-specific stuff.
– Tsyvarev
Mar 29 at 8:00
"the project can't find the headers" - Not sure about framworks, but for normal libraries you should use target_include_directories in the base project, and provide
$<INSTALL_INTERFACE:>
for your framework. By itself, PUBLIC_HEADER
just mark given header as public, but do not adjust include directory.– Tsyvarev
Mar 28 at 10:06
"the project can't find the headers" - Not sure about framworks, but for normal libraries you should use target_include_directories in the base project, and provide
$<INSTALL_INTERFACE:>
for your framework. By itself, PUBLIC_HEADER
just mark given header as public, but do not adjust include directory.– Tsyvarev
Mar 28 at 10:06
All right! Thanks a lot. My mind was set on having this only valid value for the base project : $<INSTALL_INTERFACE:include>; which is incorrect for a framework. I tried to play with generator expression to have something flexible,but the evaluation inside INSTALL_INTERFACE is tricky. Something like this doesnt work: $<INSTALL_INTERFACE:$<IF:$<TARGET_PROPERTY:VideoCapturer,FRAMEWORK>,$<TARGET_FILE_NAME:VideoCapturer>.framework/Headers,include>> so I ended up doing: target_include_directories( VideoCapturer PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework/Headers> )
– Alkalyne
Mar 29 at 7:57
All right! Thanks a lot. My mind was set on having this only valid value for the base project : $<INSTALL_INTERFACE:include>; which is incorrect for a framework. I tried to play with generator expression to have something flexible,but the evaluation inside INSTALL_INTERFACE is tricky. Something like this doesnt work: $<INSTALL_INTERFACE:$<IF:$<TARGET_PROPERTY:VideoCapturer,FRAMEWORK>,$<TARGET_FILE_NAME:VideoCapturer>.framework/Headers,include>> so I ended up doing: target_include_directories( VideoCapturer PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework/Headers> )
– Alkalyne
Mar 29 at 7:57
1
1
No needs to use generator expressions for every condition. Plain
if()
is much simpler in many cases. Generator expressions are intended to check features, which may depend on configuration type in multiconfiguration generators. That is, these features may be not known at configuration stage, when CMakeLists.txt
code is executed. But target platform is always known during configuration. So you may freely use if(MACOS)
for Macos-specific stuff.– Tsyvarev
Mar 29 at 8:00
No needs to use generator expressions for every condition. Plain
if()
is much simpler in many cases. Generator expressions are intended to check features, which may depend on configuration type in multiconfiguration generators. That is, these features may be not known at configuration stage, when CMakeLists.txt
code is executed. But target platform is always known during configuration. So you may freely use if(MACOS)
for Macos-specific stuff.– Tsyvarev
Mar 29 at 8:00
add a comment |
1 Answer
1
active
oldest
votes
The right way to install / export or package a framework is something like this : https://github.com/forexample/ios-dynamic-framework
However, it does contain a workaround, there is no find_package
This repository has a lot of good examples for "modern" CMake. check it out!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392425%2fhow-to-export-import-macos-framework-with-cmake-3-14%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The right way to install / export or package a framework is something like this : https://github.com/forexample/ios-dynamic-framework
However, it does contain a workaround, there is no find_package
This repository has a lot of good examples for "modern" CMake. check it out!
add a comment |
The right way to install / export or package a framework is something like this : https://github.com/forexample/ios-dynamic-framework
However, it does contain a workaround, there is no find_package
This repository has a lot of good examples for "modern" CMake. check it out!
add a comment |
The right way to install / export or package a framework is something like this : https://github.com/forexample/ios-dynamic-framework
However, it does contain a workaround, there is no find_package
This repository has a lot of good examples for "modern" CMake. check it out!
The right way to install / export or package a framework is something like this : https://github.com/forexample/ios-dynamic-framework
However, it does contain a workaround, there is no find_package
This repository has a lot of good examples for "modern" CMake. check it out!
edited May 22 at 4:11
answered May 8 at 6:10
AlkalyneAlkalyne
564 bronze badges
564 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392425%2fhow-to-export-import-macos-framework-with-cmake-3-14%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"the project can't find the headers" - Not sure about framworks, but for normal libraries you should use target_include_directories in the base project, and provide
$<INSTALL_INTERFACE:>
for your framework. By itself,PUBLIC_HEADER
just mark given header as public, but do not adjust include directory.– Tsyvarev
Mar 28 at 10:06
All right! Thanks a lot. My mind was set on having this only valid value for the base project : $<INSTALL_INTERFACE:include>; which is incorrect for a framework. I tried to play with generator expression to have something flexible,but the evaluation inside INSTALL_INTERFACE is tricky. Something like this doesnt work: $<INSTALL_INTERFACE:$<IF:$<TARGET_PROPERTY:VideoCapturer,FRAMEWORK>,$<TARGET_FILE_NAME:VideoCapturer>.framework/Headers,include>> so I ended up doing: target_include_directories( VideoCapturer PUBLIC $<INSTALL_INTERFACE:$CMAKE_INSTALL_LIBDIR/VideoCapturer.framework/Headers> )
– Alkalyne
Mar 29 at 7:57
1
No needs to use generator expressions for every condition. Plain
if()
is much simpler in many cases. Generator expressions are intended to check features, which may depend on configuration type in multiconfiguration generators. That is, these features may be not known at configuration stage, whenCMakeLists.txt
code is executed. But target platform is always known during configuration. So you may freely useif(MACOS)
for Macos-specific stuff.– Tsyvarev
Mar 29 at 8:00