[CMake] Super build project with the same library but different version
Jonathan Dumaresq
jdumaresq at cimeq.qc.ca
Thu Jun 28 07:23:45 EDT 2018
Hi all,
I try to do something special and I'm not sure if there a way to handle
the scenario with CMAKE correctly.
I have a superbuild project with 4 library. each library have there test
suite. I have different unit test framework needed. Here the the folder
structure
TOP-Level
|-src
|-inc
|-tests
|-CMakeList.txt
|- Catch2 <--- test framework
|-External
|-LibA
|-inc
|-src
|-tests
|-CmakeLists.txt
|-CppUTest (version 3.7)<--- test framework
|-CmakeLists.txt
|-CmakeLists.txt
|-LibB
|-inc
|-src
|-tests
|-CmakeLists.txt
|-CppUTest (version 3.8)<--- test framework
|-CmakeLists.txt
|-CmakeLists.txt
|-CmakeLists.txt
I would like to ba able to build all the tests suite for all the
library. The simple add_subdirectory doesn't owrk because of multiple
target definition for CppUTest. So the first try was with the
ExternalProject and defining different "target" for cppUTest like
ExternalProject_Add ( cppUTest3.7
...)
ExternalProject_Add ( cppUTest3.8
...)
This is working but I cannot use find_package to find it. I think I need
to do something else to be able to use find_package on it.
Here the portion of The libA CMakeLists.txt
find_package(CppUTest 3.7)
if(NOT CPPUTEST_FOUND)
ExternalProject_Add ( cppUTest3.7
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CppUTest
...)
endif()
I have the samething for libB but with 3.8 instead of 3.7
1- Is it the only way to handle this scenario ?
2- Is it possible to build all the test framework dependency before
building the real application (like at configure time) to be able to use
find_package(CppUTest 3.7) for example ?
3- Is there a better approch to do it ?
I'm relatively new to CMAKE, so maybe I miss something...
Regards
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180628/baf144cb/attachment.html>
More information about the CMake
mailing list