polysquare / cmake-unit

A unit testing framework for CMake
MIT License
36 stars 5 forks source link

Add convenience functions to generate source files and simple binaries #49

Closed smspillaz closed 9 years ago

smspillaz commented 9 years ago

Use cmake_unit_create_source_file_before_build to generate a source file during the configure phase. A NAME for the source file can be passed in as well as a list of INCLUDES, DEFINES and FUNCTIONS. Custom contents can be added using PREPEND_CONTENTS.

Use cmake_unit_generate_source_file_during_build to generate a source file in the build phase. This function takes similar arguments to cmake_unit_create_source_file_before_build.

Use cmake_unit_create_simple_executable to create a simple executable with the name NAME that just returns 0.

Use cmake_unit_create_simple_library with the name NAME and some specified FUNCTIONS to create a simple library that has those functions. The functions will be exported automatically.

If you need to get the full path to a compiled library or executable in the verify phase, then use export (TARGETS ${TARGET}) in the configure phase and then use cmake_unit_get_target_location_from_exports specifying the location of the EXPORTS file in the build-directory and the name of the target to look up.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+2.95%) when pulling e04a121c4f2ff01601bca57880c8b58c1a0848e3 on smspillaz:cmake-unit.item_47 into 3677d1d3ef386a4714ca18b6f5680d982647e55a on polysquare:master.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+2.95%) when pulling bf6281a70f6d26461ad22caf421c586e6c374eba on smspillaz:cmake-unit.item_47 into 3677d1d3ef386a4714ca18b6f5680d982647e55a on polysquare:master.