Super build project with the same library but different version

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Super build project with the same library but different version

Jonathan Dumaresq

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






--

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
Reply | Threaded
Open this post in threaded view
|

Re: Super build project with the same library but different version

Innokentiy Alaytsev
Hello!

The  DownloadProject CMake module
<https://crascit.com/2015/07/25/cmake-gtest/>   may be of use in your
situation. Basically, you can add the external project with the
add_subdirectory() function in the main build tree. However, there might be
some problems with two targets with the same name, i.e. CppUTest 3.7 and
CppUTest 3.8 will most likely both create the CppUTest target.
Unfortunately, I don't know, how to resolve this issue. The best idea I have
is to use v3.8 for bort test suits.



--
Sent from: http://cmake.3232098.n2.nabble.com/
--

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
Reply | Threaded
Open this post in threaded view
|

Re: Super build project with the same library but different version

Jonathan Dumaresq

Hi,


Le 6/28/2018 à 7:29 AM, Innokentiy Alaytsev a écrit :
Hello!

The  DownloadProject CMake module
<https://crascit.com/2015/07/25/cmake-gtest/>   may be of use in your
situation. 
Already test this idea and is' mostly work. I will take a look again.
Basically, you can add the external project with the
add_subdirectory() function in the main build tree. However, there might be
some problems with two targets with the same name, i.e. CppUTest 3.7 and
CppUTest 3.8 will most likely both create the CppUTest target.
As you guest, 2 CppUTest target is created and CMAKE give up.
Unfortunately, I don't know, how to resolve this issue. The best idea I have
is to use v3.8 for bort test suits.
The thing is that I do not want to have this dependency information in the top level CMakeLists.txt file.

Regards
Jonathan

--

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