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 via email to