Hello Johannes,

Am 2017-11-22 um 12:03 schrieb Johannes Zarl-Zierl:
The problem in this specific case is that CMake ships with a FindJPEG module
that does not define modern import libs, but uses the old way of defining
<PACKAGE>_LIBRARIES and <PACKAGE>_INCLUDE_DIRS.
IMO this highlights one of the main problems with find modules: nobody really
maintains them.

If JPEG had proper imported targets, your code could look like this:
[...]
You just have to make sure that your shipped libjpeg creates the proper
namespaced target:
add_library(JPEG ...)
add_library(JPEG::JPEG ALIAS JPEG)

Thanks for your reply, but how can I proceed from here?

In order to be able to write in the parent script something that works in either case, that is,

target_link_libraries(main_program <either JPEG::JPEG or ${JPEG...} or ???>)

it seems that I either

- have to make a copy of FindJPEG.cmake, customize it to define target JPEG::JEPG and ship it along with my project,

- or write my `../ExtLibs/libjpeg/CMakeLists.txt` so that it globally defines JPEG_LIBRARIES and JPEG_INCLUDE_DIRS

Is that right?

Best regards,
Carsten
--

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

Reply via email to