Quantcast

Evaluate generator expressions with install interface

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Evaluate generator expressions with install interface

CMake mailing list
Hi,

I would like to evaluate generator expressions to generate a pkgconfig file. Something like:

function(auto_pkgconfig TARGET)
    file(GENERATE OUTPUT ${TARGET}.pc CONTENT "
Name: ${TARGET}
Cflags: -I$<JOIN:$<TARGET_PROPERTY:${TARGET},INTERFACE_INCLUDE_DIRECTORIES>, -I>
Libs: -L$<TARGET_FILE_DIR:${TARGET}> -l${TARGET}
")
    install(FILES ${TARGET}.pc DESTINATION lib/pkgconfig)
endfunction()

However, this doesn’t work very well. It always evaluates the build interface or computes the TARGET_FILE_DIR according the build directory instead of installation. Also, if include directories are added to the target after calling `auto_pkgconfig` it doesn’t capture those(ie it runs file(GENERATE) at config time instead of generator time).

So, is there a way to evaluate generator expressions for installation? And evaluate them at generator time?

Calling `file(GENERATE)` at installation time(with install(CODE) or install(SCRIPT)) does not solve this problem either.

Thanks,
Paul
--

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:
http://public.kitware.com/mailman/listinfo/cmake
Loading...