[CMake] Testing our CMake Modules

Kai Wolf kai.wolf at gmail.com
Mon Dec 10 07:47:08 EST 2018


They (Kitware) typically write custom .cmake files to test the function/macro under test coupled together with a CMakeLists.txt file and/or a small C/C++ implementation file. Look here [1] for some examples, for instance CMake/Tests/MacroTest.

Greetings,

Kai

http://kai-wolf.me
http://effective-cmake.com

[1] https://github.com/Kitware/CMake/tree/master/Tests

> Am 10.12.2018 um 13:30 schrieb Ramold, Felix <Felix.Ramold at kuka.com>:
> 
> We created multiple additional functions for CMake. They became quite a lot, and we need to (unit) test them.
> There are simple ones, that are only variable bases like:
> function(join_list LIST GLUE)
> These can be tested with a custom CMake Script, that checks the results. For this we also wrote a set of assert-macros.
> This becomes way harder when the functions are target based:
> function(target_my_custom_property_set TARGET VALUE)
> We need a multiple CMakeLists.txt Files that need to be configured. Configuration must succeed or fail with specified messages. Also the result files must be checked.
> I wonder, is there an easier way? Is there a existing framework? How does Kitware test the shipped modules?
> Note: My original Stackoverflow question: https://stackoverflow.com/questions/51948060/testing-our-cmake-modules
> 
> Thanks,
> Felix
> --
> 
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Message signed with OpenPGP
URL: <https://cmake.org/pipermail/cmake/attachments/20181210/5e5aaec1/attachment.sig>


More information about the CMake mailing list