Using find_package with different build trees

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

Using find_package with different build trees

Stefanos Mitropoulos

Hello all!


I am trying to follow the modern cmake path and use the find_packages()/link libraries way.

I am using a test scenario in which: LIB_B depends on LIB_A and EXEC_A depends on both.

I was wondering how you could link EXEC_A to the debug lib version of LIB_B and the release version of LIB_A or vice versa.

On LIB_A I am using set(CMAKE_DEBUG_POSTFIX "-debug")
so my LIB_A is going to be LIB_A-debug when making the debug tree. I install them in /usr/local/lib and both reside there.

For example let's say I have this line of code in LIB_A:

#ifdef Release  
printf("THIS IS RELEASE MODE"); 
#endif 

This is going to differentiate LIB_A and LIB_A-debug.

in EXEC_A I would use

find_package(LIBA REQUIRED) 
add_executable(EXEC_A main.cpp) 
target_link_libraries(EXEC_A PUBLIC LIBS::LIBA LIBS::LIBB) 

assuming I have exported the libraries in the LIBS namespace.

Is there any way to differentiate between library versions?

EDIT: I am on Linux (centos) and using GCC 8. My CMake version is 3.14



--
Email Signature
Stefanos Mitropoulos
Developer
Logo
 
EDPS S.A.
t: 30-210-8993660
e: [hidden email]
 
www.edps.gr
 
The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.
   

--

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