[A] Add package installation test
This commit is contained in:
parent
75638e8f22
commit
d09633df55
14
.travis.yml
14
.travis.yml
@ -255,6 +255,20 @@ script:
|
||||
# scan-build make ;
|
||||
# fi
|
||||
|
||||
# Test package installation
|
||||
- cd ..
|
||||
- rm -r build/*
|
||||
- cmake -H. -Bbuild -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=`pwd`/install
|
||||
- cmake --build build --target all
|
||||
- cmake --build build -- install
|
||||
- ls `pwd`/install
|
||||
- cd tests/package_tests
|
||||
- cmake -H. -B_build -DCMAKE_PREFIX_PATH=../../install -DCMAKE_C_STANDARD=99 -DCMAKE_CXX_STANDARD=11
|
||||
- cmake --build _build -- -j3
|
||||
- ./_build/app
|
||||
- rm -rf _build
|
||||
- cd ../../build
|
||||
|
||||
# Build for coveralls (should be the last)
|
||||
- |
|
||||
if [ "${CC}" = 'gcc' ]; then
|
||||
|
@ -265,7 +265,7 @@ endforeach()
|
||||
# Exported targets for outer applications.
|
||||
# ------------------------------------------------------------------------------
|
||||
export(
|
||||
TARGETS fort
|
||||
TARGETS fort
|
||||
FILE ${PROJECT_NAME}-targets.cmake
|
||||
)
|
||||
|
||||
|
16
tests/package_tests/1-simple_table.cpp
Normal file
16
tests/package_tests/1-simple_table.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "fort.hpp"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
fort::char_table table;
|
||||
table << fort::header
|
||||
<< "N" << "Driver" << "Time" << "Avg Speed" << fort::endr
|
||||
<< "1" << "Ricciardo" << "1:25.945" << "47.362" << fort::endr
|
||||
<< "2" << "Hamilton" << "1:26.373" << "35.02" << fort::endr
|
||||
<< "3" << "Verstappen" << "1:26.469" << "29.78" << fort::endr;
|
||||
|
||||
std::cout << table.to_string() << std::endl;
|
||||
}
|
23
tests/package_tests/CMakeLists.txt
Normal file
23
tests/package_tests/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
find_package(libfort)
|
||||
|
||||
# Assert exports of libfort
|
||||
if (NOT libfort_FOUND)
|
||||
message(FATAL_ERROR "libfort was not found")
|
||||
endif()
|
||||
if (NOT TARGET libfort::fort)
|
||||
message(FATAL_ERROR "TARGET libfort::fort not found")
|
||||
endif()
|
||||
if (NOT DEFINED libfort_LIBRARIES)
|
||||
message(FATAL_ERROR "libfort_LIBRARIES are not defined")
|
||||
endif()
|
||||
if (NOT ${libfort_VERSION} EQUAL "0.4.0")
|
||||
message(FATAL_ERROR "libfort_VERSION is incorrect")
|
||||
endif()
|
||||
|
||||
add_executable(app
|
||||
1-simple_table.cpp)
|
||||
|
||||
target_link_libraries(app
|
||||
libfort::fort)
|
Loading…
Reference in New Issue
Block a user