-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize CMakeLists.txt for Attribute
- Loading branch information
1 parent
4a1f849
commit bef19e4
Showing
3 changed files
with
102 additions
and
26 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,31 +1,97 @@ | ||
# Note: | ||
# If new src or test cpp files are added make sure you touch this file | ||
# | ||
file( GLOB srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp" "src/*.hpp" ) | ||
# Copyright 2023- ECMWF. | ||
# | ||
# This software is licensed under the terms of the Apache Licence version 2.0 | ||
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
# In applying this licence, ECMWF does not waive the privileges and immunities | ||
# granted to it by virtue of its status as an intergovernmental organisation | ||
# nor does it submit to any jurisdiction. | ||
# | ||
|
||
ecbuild_add_library( TARGET nodeattr | ||
NOINSTALL | ||
TYPE STATIC | ||
SOURCES ${srcs} | ||
) | ||
|
||
target_link_libraries(nodeattr PRIVATE core) | ||
target_include_directories(nodeattr PUBLIC src | ||
../ACore/src | ||
${Boost_INCLUDE_DIRS}) | ||
set(srcs | ||
# Headers | ||
src/AutoArchiveAttr.hpp | ||
src/AutoCancelAttr.hpp | ||
src/ClockAttr.hpp | ||
src/CronAttr.hpp | ||
src/DateAttr.hpp | ||
src/DayAttr.hpp | ||
src/GenericAttr.hpp | ||
src/LateAttr.hpp | ||
src/NodeAttr.hpp | ||
src/QueueAttr.hpp | ||
src/RepeatAttr.hpp | ||
src/TimeAttr.hpp | ||
src/TodayAttr.hpp | ||
src/Variable.hpp | ||
src/VerifyAttr.hpp | ||
src/Zombie.hpp | ||
src/ZombieAttr.hpp | ||
# Sources | ||
src/AutoArchiveAttr.cpp | ||
src/AutoCancelAttr.cpp | ||
src/ClockAttr.cpp | ||
src/CronAttr.cpp | ||
src/DateAttr.cpp | ||
src/DayAttr.cpp | ||
src/GenericAttr.cpp | ||
src/LateAttr.cpp | ||
src/NodeAttr.cpp | ||
src/QueueAttr.cpp | ||
src/RepeatAttr.cpp | ||
src/TimeAttr.cpp | ||
src/TodayAttr.cpp | ||
src/Variable.cpp | ||
src/VerifyAttr.cpp | ||
src/Zombie.cpp | ||
src/ZombieAttr.cpp | ||
) | ||
|
||
ecbuild_add_library( | ||
TARGET | ||
nodeattr | ||
NOINSTALL | ||
TYPE STATIC | ||
SOURCES | ||
${srcs} | ||
PUBLIC_INCLUDES | ||
src | ||
PUBLIC_LIBS | ||
core | ||
Boost::date_time | ||
) | ||
target_clangformat(nodeattr) | ||
|
||
|
||
file( GLOB test_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "test/*.cpp" ) | ||
|
||
# libboost_unit_test_framework undefined reference to `clock_gettime', ${LIBRT} needed for boost 1.71 | ||
ecbuild_add_test( TARGET u_anattr | ||
SOURCES ${test_srcs} | ||
INCLUDES src ${Boost_INCLUDE_DIRS} | ||
LIBS nodeattr ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} | ||
DEFINITIONS ${BOOST_TEST_DYN_LINK} | ||
TEST_DEPENDS u_acore | ||
) | ||
set(test_srcs | ||
# Sources | ||
test/TestAttributes_main.cpp | ||
test/TestAttrSerialization.cpp | ||
test/TestCron.cpp | ||
test/TestDateAttr.cpp | ||
test/TestDayAttr.cpp | ||
test/TestLabel.cpp | ||
test/TestLateAttr.cpp | ||
test/TestMigration.cpp | ||
test/TestRepeat.cpp | ||
test/TestSizeOf.cpp | ||
test/TestTimeAttr.cpp | ||
test/TestTodayAttr.cpp | ||
test/TestVariable.cpp | ||
test/TestZombieAttr.cpp | ||
) | ||
|
||
target_clangformat(u_anattr CONDITION ENABLE_TESTS) | ||
ecbuild_add_test( | ||
TARGET | ||
u_anattr | ||
SOURCES | ||
${test_srcs} | ||
LIBS | ||
nodeattr | ||
TEST_DEPENDS | ||
u_acore | ||
Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) | ||
) | ||
target_clangformat(u_anattr | ||
CONDITION ENABLE_TESTS | ||
) |
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,12 @@ | ||
/* | ||
* Copyright 2023- ECMWF. | ||
* | ||
* This software is licensed under the terms of the Apache Licence version 2.0 | ||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
* In applying this licence, ECMWF does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an intergovernmental organisation | ||
* nor does it submit to any jurisdiction. | ||
*/ | ||
|
||
#define BOOST_TEST_MODULE TestAttributes | ||
#include <boost/test/included/unit_test.hpp> |