Skip to content

Commit

Permalink
Modernize CMakeLists.txt for Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbento committed Nov 13, 2023
1 parent 4a1f849 commit bef19e4
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 26 deletions.
114 changes: 90 additions & 24 deletions ANattr/CMakeLists.txt
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
)
2 changes: 0 additions & 2 deletions ANattr/test/TestAttrSerialization.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define BOOST_TEST_MODULE TestANattr

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// Name :
// Author : Avi
Expand Down
12 changes: 12 additions & 0 deletions ANattr/test/TestAttributes_main.cpp
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>

0 comments on commit bef19e4

Please sign in to comment.