On Monday, December 4, 2017, Carsten Fuchs <<a href="mailto:carsten.fuchs@cafu.de">carsten.fuchs@cafu.de</a>> wrote:<br>> Thanks to all!<br>><br>> Well, I guess I'm among the people mentioned by Lectem at <a href="https://www.mail-archive.com/cmake-developers@cmake.org/msg18267.html">https://www.mail-archive.com/cmake-developers@cmake.org/msg18267.html</a><br>><br>> I'll try to dig my way through it, but at this point I consider staying with SCons under Linux, where finding packages is important and the command line is used anyway, and using CMake under Windows only, where quasi all external libraries are shipped along with the project and the real goal is to obtain a Visual Studio solution. (I already have a complete build with SCons that works under Windows and Linux for my project which is of average complexity.)<br>><br><br>Hello,<br><br>Are you able to link to your project? I am interested in how you have set up your build system.<br><br>Cheers,<br>     R0b0t1<br><br>> Best regards,<br>> Carsten<br>><br>> $ ls Cafu/ExtLibs/ -1<br>> bullet<br>> Cg<br>> fbx<br>> fmod<br>> freealut<br>> freetype<br>> glfw<br>> jpeg<br>> libogg<br>> libpng<br>> libvorbis<br>> lua<br>> lwo<br>> MersenneTwister.h<br>> minizip<br>> mpg123<br>> noise<br>> openal-soft<br>> openal-win<br>> pstdint.h<br>> tclap<br>> wxWidgets<br>> zlib<br>><br>><br>><br>> Am 29.11.2017 um 21:17 schrieb Florent Castelli:<br>>><br>>> On 29/11/2017 12:02, Johannes Zarl-Zierl wrote:<br>>>><br>>>> Hello Carsten,<br>>>><br>>>> On Samstag, 25. November 2017 11:46:44 CET Carsten Fuchs wrote:<br>>>>><br>>>>> Thanks for your reply, but how can I proceed from here?<br>>>>><br>>>>> In order to be able to write in the parent script something that works<br>>>>> in either case, that is,<br>>>>><br>>>>> target_link_libraries(main_program <either JPEG::JPEG or ${JPEG...} or ???>)<br>>>><br>>>> Well, that's one way, but that doesn't really provide any benefit above the<br>>>> original solution (i.e. just define the JPEG_INCLUDES and JPEG_LIBRARIES<br>>>> variables accordingly).<br>>>><br>>>>> it seems that I either<br>>>>><br>>>>>     - have to make a copy of FindJPEG.cmake, customize it to define<br>>>>> target JPEG::JEPG and ship it along with my project,<br>>>><br>>>> Either that or you define it yourself:<br>>>> find_package(JPEG)<br>>>> if (JPEG_FOUND)<br>>><br>>> I'd say "if(JPEG_FOUND AND NOT TARGET JPEG::JPEG)"<br>>> If someone improves FindJPEG.cmake, you won't break your build.<br>>><br>>>>   add_library(JPEG::JPEG UNKNOWN IMPORTED)<br>>>>   set_property(<br>>>>    TARGET JPEG::JPEG<br>>>>    PROPERTY IMPORTED_LOCATION ${JPEG_LIBRARIES}<br>>>>    )<br>>>>   set_property(<br>>>>    TARGET JPEG::JPEG PROPERTY<br>>>>    INTERFACE_INCLUDE_DIRECTORIES ${JPEG_INCLUDES}<br>>>>   )<br>>>> endif()<br>>>><br>>>> I admit it's not a huge benefit over just using the variables. The advantages:<br>>>> - you get slightly better error handling<br>>>> - your target_link_libraries commands are slightly more readable.<br>>>><br>>>>>     - or write my `../ExtLibs/libjpeg/CMakeLists.txt` so that it globally<br>>>>> defines JPEG_LIBRARIES and JPEG_INCLUDE_DIRS<br>>>><br>>>> That will work, too.<br>>>><br>>>><br>>>> Cheers,<br>>>>    Johannes<br>>>><br>>><br>><br>> --<br>><br>> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>><br>> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>><br>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>><br>> CMake Support: <a href="http://cmake.org/cmake/help/support.html">http://cmake.org/cmake/help/support.html</a><br>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html">http://cmake.org/cmake/help/consulting.html</a><br>> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html">http://cmake.org/cmake/help/training.html</a><br>><br>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>><br>> Follow this link to subscribe/unsubscribe:<br>> <a href="http://public.kitware.com/mailman/listinfo/cmake">http://public.kitware.com/mailman/listinfo/cmake</a>