-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add find_package test when pfs is not installed
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,13 @@ | ||
@PACKAGE_INIT@ | ||
check_required_components(pfs) | ||
|
||
set(pfs_FOUND TRUE) | ||
|
||
set(pfs_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include") | ||
|
||
set(pfs_LIBRARIES pfs) | ||
set(pfs_LIBRARY_DIR "${CMAKE_CURRENT_LIST_DIR}/lib") | ||
|
||
set(pfs_INCLUDE_DIRS "${pfs_INCLUDE_DIRS}" CACHE STRING "pfs include directories" FORCE) | ||
set(pfs_LIBRARIES "${pfs_LIBRARIES}" CACHE STRING "pfs libraries" FORCE) | ||
set(pfs_LIBRARY_DIR "${pfs_LIBRARY_DIR}" CACHE STRING "pfs library dirs" FORCE) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_minimum_required (VERSION 3.5) | ||
|
||
project (find_package) | ||
|
||
find_package (pfs PATHS /pfs NO_DEFUALT_PATH REQUIRED) | ||
|
||
set (SOURCES find_package.cpp) | ||
|
||
add_executable (find_package ${SOURCES}) | ||
|
||
target_link_libraries (find_package -L${pfs_LIBRARY_DIR} ${pfs_LIBRARIES}) | ||
target_include_directories (find_package PRIVATE ${pfs_INCLUDE_DIRS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
main() { | ||
if [[ "$#" -ne 1 ]]; then | ||
echo "Usage: $0 <test_name>" | ||
return 2 | ||
fi | ||
declare -r test_name="$1" | ||
|
||
declare -r project_name="find_package" | ||
|
||
declare -r pfs_dir="/pfs" | ||
declare -r cmake_tests_dir="$pfs_dir/test/cmake" | ||
|
||
declare -r source_file="$cmake_tests_dir/$project_name.cpp" | ||
if [[ ! -f "$source_file" ]]; then | ||
echo "[!] Cannot find test source file [$source_file]" | ||
return 1 | ||
fi | ||
|
||
declare -r test_dir="$cmake_tests_dir/${project_name}_${test_name}" | ||
if [[ ! -d "$test_dir" ]]; then | ||
echo "[!] Cannot find test [$test_dir]" | ||
return 1 | ||
fi | ||
|
||
declare -r target_dir="/$project_name" | ||
echo "[=] Deleting target dir [$target_dir]" | ||
rm -rf "$target_dir" | ||
|
||
echo "[=] Copying test and source file to target dir" | ||
cp -R "$test_dir" "$target_dir" | ||
cp "$source_file" "$target_dir/." | ||
|
||
echo "[=] Building..." | ||
(cd "$target_dir"; cmake .; make; "./$project_name" "/dev/pts/0") | ||
} | ||
|
||
main "$@" |