[CMake] set_property imported_location_release

Marc CHEVRIER marc.chevrier at gmail.com
Fri Dec 21 09:46:18 EST 2018


Yes, the most efficient way is using conditional setting. For example:

if (CMAKE_SIZEOF_VOID_P EQUAL 4)
  set(import_path /to/lib32)
else()
  set(import_path /to/lib64)
endif()

set_property(TARGET foo PROPERTY IMPORT_LOCATION "${import_path}/lib.so")

Le 21 déc. 2018 à 15:14 +0100, Lars <laasunde at hotmail.com>, a écrit :
> Marc,
>
> Appreciate the quick and helpful response.
>
> In a config file that supports multiple platforms, do I need to create import_location_path variable and populate it depending on platform and 32/64 etc? Any other options?
>
> Thanks.
>
> Kind regards, Lars
>
> Fra: Marc CHEVRIER <marc.chevrier at gmail.com>
> Sendt: fredag 21. desember 2018 13.41
> Til: cmake at cmake.org; Lars
> Emne: Re: [CMake] set_property imported_location_release
>
> Properties IMPORTED_LOCATION* do not support generator expressions.
>
> Generally speaking, if a property supports generator expression, it is explicitly specified in documentation.
> Le 21 déc. 2018 à 13:07 +0100, Lars <laasunde at hotmail.com>, a écrit :
> > Hello,
> >
> > Trying to import an external library but having some issue with setting imported_location_release property.
> >
> > Basically I have config file which does this;
> > add_library(foo STATIC IMPORTED)
> > set_property(target foo APPEND PROPERTY
> >    interface_include_directories
> >     "$<BUILD_INTERFACE:${foot_root}/path>"
> >     "$<INSTALL_INTERFACE:${foo_root}/foo>")
> >
> > set_property(TARGET foo APPEND PROPERTY
> >   IMPORTED_LOCATION_RELEASE
> >     $<$<CXX_COMPILER_ID:GNU>:${foo_root}/lib/release/foo.a>)
> >
> > The imported target is used in a target_link_libraries method;
> > target_link_libraries(an_application foo)
> >
> > Running CMake 3.6.1 does not produce any warnings. Running make I get a "target pattern contains no '%'" error message with a reference to a Build.make file.
> >
> > The Build.make contains the string " $<$<CXX_COMPILER_ID:GNU>:/tmp/prototype/foo/lib/release/foo.a".  We did not expect to see the generator expression in the Build.make file.
> >
> > Does set_property support generator expression in this context? What are we doing wrong?
> >
> > Appreciate any help :-)
> >
> > king regards, Lars
> >
> > --
> >
> > Powered by www.kitware.com
> >
> > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> >
> > CMake Support: http://cmake.org/cmake/help/support.html
> > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> > CMake Training Courses: http://cmake.org/cmake/help/training.html
> >
> > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > https://cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181221/64aacf40/attachment.html>


More information about the CMake mailing list