Skip to content

Commit

Permalink
more tries at installer test
Browse files Browse the repository at this point in the history
  • Loading branch information
phlptp committed Aug 13, 2021
1 parent 6806410 commit 2bc410b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
docker:
- image: helics/buildenv:builder
environment:
CMAKE_FLAGS: '-DUNITS_BUILD_TESTS=ON -DUNITS_INSTALL_PACKAGE_TESTS=ON -DUNITS_BUILD_SHARED_LIBRARY=ON'
CMAKE_FLAGS: '-DUNITS_ENABLE_TESTS=ON -DUNITS_INSTALL_PACKAGE_TESTS=ON -DUNITS_BUILD_SHARED_LIBRARY=ON'
steps:
- checkout
- run: *setup_units
Expand Down
28 changes: 26 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,31 @@ if(UNITS_INSTALL)
install(TARGETS compile_flags_target ${UNITS_LIBRARY_EXPORT_COMMAND})
endif()
if(UNITS_WITH_CMAKE_PACKAGE AND NOT UNITS_BINARY_ONLY_INSTALL)
install(EXPORT unitsConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/units)
export(EXPORT unitsConfig)
install(EXPORT unitsConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
export(EXPORT unitsConfig NAMESPACE units::)
write_basic_package_version_file(${PROJECT_BINARY_DIR}/unitsConfigVersion.cmake COMPATIBILITY AnyNewerVersion)
install(FILES ${PROJECT_BINARY_DIR}/unitsConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/units)
endif()
endif()



#if(HELICS_WITH_CMAKE_PACKAGE)

# set(HELICS_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
# CACHE STRING "install path for HELICSConfig.cmake"
# )
# mark_as_advanced(HELICS_CMAKECONFIG_INSTALL_DIR)

# Export targets for importing build tree with find_package
# export(EXPORT helics-targets NAMESPACE HELICS::
# FILE ${PROJECT_BINARY_DIR}/helics-targets.cmake
# )

# install(
# EXPORT helics-targets
# NAMESPACE HELICS::
# DESTINATION ${HELICS_CMAKECONFIG_INSTALL_DIR}
# COMPONENT libs
# )
endif()
8 changes: 4 additions & 4 deletions test/find_package_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ project(units-find-package-test)
include(CTest)

# Test the HELICS CMake package config
find_package(UNITS 0.5 REQUIRED)
find_package(units 0.4.8 REQUIRED)

# add some tests inside of the CMake

message(STATUS "Binary location is ${PROJECT_BINARY_DIR}")
# Test the CXX shared library target
if(UNITS_BUILD_SHARED_LIBRARY)
add_executable(shared-library-test-exe ../pkg_test_code/main.cpp)
target_link_libraries(shared-library-test-exe UNITS::units)
target_link_libraries(shared-library-test-exe units::units)

add_test(NAME shared-library-test COMMAND shared-library-test-exe)
set_property(
TEST shared-library-test PROPERTY PASS_REGULAR_EXPRESSION "${HELICS_VERSION}"
TEST shared-library-test PROPERTY PASS_REGULAR_EXPRESSION "10.7"
)

# Test the C and C++98 targets
elseif(UNITS_HEADER_ONLY)
add_executable(header_only-exe ../pkg_test_code/header_only.cpp)
target_link_libraries(header_only-exe UNITS::units_headers)
target_link_libraries(header_only-exe units::units_headers)

add_test(NAME header_only-exe COMMAND header_only-exe)
set_property(
Expand Down
2 changes: 1 addition & 1 deletion units/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ else()
endif()

if(UNITS_INSTALL AND NOT UNITS_BINARY_ONLY_INSTALL)
install(FILES ${units_header_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${units_header_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/units)
if(UNITS_BUILD_SHARED_LIBRARY OR BUILD_SHARED_LIBS)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/units_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/units
Expand Down

0 comments on commit 2bc410b

Please sign in to comment.