[CMakeLists.txt]
- Bumped cmake minimum requirement to go to 3.0 as this
appears to be earliest version that transitive usage
requirements are supported.
- Added version to project so that is evident
when looking at CMakeLists.txt
- Removed include_directories as that command
affects more than just UnitTest++ in favor
of target_include_directories.
- The target_include_directories uses the
generator expressions to do the same thing
for the BUILD_INTERFACE condition but only
affects UnitTest++. The INSTALL_INTERFACE
ensures that when UnitTest++ is installed
client applications calling find_package
for UnitTest++ only have to add the
UnitTest++ target to the target_link_libraries
and will get the correct include path
for UnitTest++ added to their include paths.
- Added DEBUG_POSTFIX to both library and
unit test to distinguish them from each other
as they are installed into the same directory
and would otherwise overwrite one another.
- Added Versioning using write_basic_package_version_file
to the install so that a client can call
find_package(UnitTest++ 2.1 REQUIRED) and it will be
able to confirm the version. If the version is updated
you could theoretically ahve a version 2.2, 2.3 ,etc...
and the find_package mechanism will find the correct one.
the SameMajorVersion option in that call indicates
that 2.3 is compatible with 2.1 or in other words if
find_package(UnitTest++ 2.1 REQUIRED) is called and
2.3 is installed that satisfies the condition but
if only 3.0 was installed it will fail because of
'SameMajorVersion'.
- Also added installation for the Version file.
As part of this, changed the option name to
`UTPP_INCLUDE_TESTS_IN_BUILD`. The test target is still added to the
build and can be built/run separately using the CMake --target option.
UTPP_SKIP_TESTS_AS_BUILD_STEP with a default value of OFF was an
unfortunate choice, so this changes it to UTPP_RUN_TESTS_AS_BUILD_STEP
with a default value of ON.
Added export configuration for UnitTest++ target and installed the export and config file in libs/cmake/UnitTest++.
Added basic UnitTest++Config.cmake file which includes exported targets file and sets UTPP_INCLUDE_DIRS to the install location of the includes directory, this allows UnitTest++ to be used as a normal target in your own CMakeLists.txt file.
e.g.:
find_package(UnitTest++ REQUIRED NO_MODULE)
add_executable(foo ...)
include_directories(${UTPP_INCLUDE_DIRS})
target_link_libraries(foo UnitTest++)
which will ensure the library and installed headers paths are set up correctly for your own target.
This is how it used to be in most of the old project files. The
CMake conversion required the tests to be run manually after the
build, either by running the binary directly or by calling CTest.
This commit removes the 'dependency' on CTest and restores the
old build process.
This commit adds install() directives to the CMake file. By default,
headers will be installed to CMAKE_INSTALL_PREFIX/include/UnitTest++
and libUnitTest++.a will be installed to CMAKE_INSTALL_PREFIX/lib.
If the user defines UTPP_USE_PLUS_SIGN=OFF when generating, the ++
will be replaced with PP in both the library file name and the
include path.
This commit adds install() directives to the CMake file. By default,
headers will be installed to CMAKE_INSTALL_PREFIX/include/UnitTest++
and libUnitTest++.a will be installed to CMAKE_INSTALL_PREFIX/lib.
If the user defines UTPP_USE_PLUS_SIGN=OFF when generating, the ++
will be replaced with PP in both the library file name and the
include path.