diff options
| author | dweckmann <didier.weckmann@ircad.fr> | 2020-12-29 04:35:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-28 19:35:08 -0800 |
| commit | e2d34085478b0a8d13120287894a52b7e104fd3f (patch) | |
| tree | 484cf0ca53f090785569cde02679566a9e5f0aa1 /ports/cppunit/CppUnitConfig.cmake | |
| parent | 6d84d56cd5ebc4c61ad093bd4de803ac3fea412f (diff) | |
| download | vcpkg-e2d34085478b0a8d13120287894a52b7e104fd3f.tar.gz vcpkg-e2d34085478b0a8d13120287894a52b7e104fd3f.zip | |
[cppunit] add linux support and bump version to 1.15.1 (#15018)
Diffstat (limited to 'ports/cppunit/CppUnitConfig.cmake')
| -rw-r--r-- | ports/cppunit/CppUnitConfig.cmake | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/ports/cppunit/CppUnitConfig.cmake b/ports/cppunit/CppUnitConfig.cmake new file mode 100644 index 000000000..b3e6146d1 --- /dev/null +++ b/ports/cppunit/CppUnitConfig.cmake @@ -0,0 +1,83 @@ + +include(SelectLibraryConfigurations) + +find_path(CppUnit_INCLUDE_DIR TestCase.h PATH_SUFFIXES cppunit) +find_library(CppUnit_LIBRARY_RELEASE NAMES cppunit PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" NO_DEFAULT_PATH) +find_library(CppUnit_LIBRARY_DEBUG NAMES cppunitd cppunit PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib" NO_DEFAULT_PATH) +select_library_configurations(CppUnit) + +if(NOT CppUnit_LIBRARY) + set(CppUnit_FOUND FALSE) + set(CPPUNIT_FOUND FALSE) + return() +endif() + +if(WIN32) + find_file(CppUnit_LIBRARY_RELEASE_DLL NAMES cppunit.dll PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin" NO_DEFAULT_PATH) + find_file(CppUnit_LIBRARY_DEBUG_DLL NAMES cppunitd.dll PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/bin" NO_DEFAULT_PATH) +endif() + +# Manage Release Windows shared +if(EXISTS "${CppUnit_LIBRARY_RELEASE_DLL}") + add_library(CppUnit SHARED IMPORTED) + set_target_properties(CppUnit PROPERTIES + IMPORTED_CONFIGURATIONS Release + IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE_DLL}" + IMPORTED_IMPLIB_RELEASE "${CppUnit_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}" + ) +endif() + +# Manage Debug Windows shared +if(EXISTS "${CppUnit_LIBRARY_DEBUG_DLL}") + if(EXISTS "${CppUnit_LIBRARY_RELEASE_DLL}") + set_target_properties(CppUnit PROPERTIES + IMPORTED_CONFIGURATIONS "Release;Debug" + IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE_DLL}" + IMPORTED_IMPLIB_RELEASE "${CppUnit_LIBRARY_RELEASE}" + IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG_DLL}" + IMPORTED_IMPLIB_DEBUG "${CppUnit_LIBRARY_DEBUG}" + INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}" + ) + else() + add_library(CppUnit SHARED IMPORTED) + set_target_properties(CppUnit PROPERTIES + IMPORTED_CONFIGURATIONS Debug + IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG_DLL" + IMPORTED_IMPLIB_DEBUG "${CppUnit_LIBRARY_DEBUG}" + INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}" + ) + endif() +endif() + +# Manage Release Windows static and Linux shared/static +if((NOT EXISTS "${CppUnit_LIBRARY_RELEASE_DLL}") AND (EXISTS "${CppUnit_LIBRARY_RELEASE}")) + add_library(CppUnit UNKNOWN IMPORTED) + set_target_properties(CppUnit PROPERTIES + IMPORTED_CONFIGURATIONS Release + IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE}" + INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}" + ) +endif() + +# Manage Debug Windows static and Linux shared/static +if((NOT EXISTS "${CppUnit_LIBRARY_DEBUG_DLL}") AND (EXISTS "${CppUnit_LIBRARY_DEBUG}")) + if(EXISTS "${CppUnit_LIBRARY_RELEASE}") + set_target_properties(CppUnit PROPERTIES + IMPORTED_CONFIGURATIONS "Release;Debug" + IMPORTED_LOCATION_RELEASE "${CppUnit_LIBRARY_RELEASE}" + IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG}" + INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}" + ) + else() + add_library(CppUnit UNKNOWN IMPORTED) + set_target_properties(CppUnit PROPERTIES + IMPORTED_CONFIGURATIONS Debug + IMPORTED_LOCATION_DEBUG "${CppUnit_LIBRARY_DEBUG}" + INTERFACE_INCLUDE_DIRECTORIES "${CppUnit_INCLUDE_DIR}" + ) + endif() +endif() + +set(CppUnit_FOUND TRUE) +set(CPPUNIT_FOUND TRUE)
\ No newline at end of file |
