-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow passing PUBLIC_DEFINITIONS to ecbuild_add_library for INTERFACE…
… libraries
- Loading branch information
1 parent
889ab11
commit 441e967
Showing
7 changed files
with
82 additions
and
5 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
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
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,2 @@ | ||
build_test_interface_library | ||
install_test_interface_library |
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,7 @@ | ||
|
||
ecbuild_add_test( | ||
TARGET test_ecbuild_interface_library | ||
TYPE SCRIPT | ||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build-and-run.sh | ||
ENVIRONMENT CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} | ||
) |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} | ||
SOURCE=${CMAKE_CURRENT_SOURCE_DIR:-$HERE} | ||
|
||
# Add ecbuild to path | ||
export PATH=$SOURCE/../../bin:$PATH | ||
echo $PATH | ||
echo $SOURCE | ||
|
||
run_test() { | ||
|
||
local tname=$1 | ||
local exp_sts=$2 | ||
shift 2 | ||
|
||
local bdir=$HERE/build_$tname | ||
local idir=$HERE/install_$tname | ||
local logf=$HERE/$tname.log | ||
|
||
mkdir -p $bdir && cd $bdir | ||
local sts=0 | ||
echo "Running test '$tname'" | ||
ecbuild --prefix=$idir -- -Wno-deprecated $* $SOURCE/test_project >$logf 2>&1 || sts=$? | ||
|
||
make install | ||
|
||
if [[ $sts -ne $exp_sts ]] ; then | ||
echo "Test '$tname': expected exit code $exp_sts, got $sts" | ||
cat $logf | ||
exit 1 | ||
fi | ||
} | ||
|
||
# --------------------- cleanup ------------------------ | ||
$SOURCE/clean.sh | ||
|
||
# ---------------------- tests ------------------------- | ||
run_test test_interface_library 0 |
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,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
HERE=${CMAKE_CURRENT_BINARY_DIR:-"$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"} | ||
|
||
# --------------------- cleanup ------------------------ | ||
echo "cleaning $HERE" | ||
rm -rf $HERE/build_* $HERE/*.log |
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,13 @@ | ||
cmake_minimum_required(VERSION 3.17 FATAL_ERROR) | ||
|
||
find_package( ecbuild REQUIRED ) | ||
project( test_interface_library VERSION 0.1.0 LANGUAGES C ) | ||
|
||
ecbuild_add_library( TARGET intfb_lib TYPE INTERFACE | ||
PUBLIC_INCLUDES | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
$ENV{HOME} | ||
PUBLIC_LIBS some_lib | ||
PUBLIC_DEFINITIONS MYDEF=1 | ||
) | ||
ecbuild_install_project( NAME test_interface_library ) |