Getting CMake warning because of CMP0048 even after bumping up CMake Minimum Version
Working on building and testing my ROS package in noetic
. I get the following warning:
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.
I have edited my CMakeLists.txt to have the following line to bump up minimum version of CMake:
cmake_minimum_required(VERSION 3.0.2)
Similar to this.
But I am still getting the warning. Am I missing something? I am not seeing this in my melodic
build.
Edit: My CMakeLists.txt
looks like below:
cmake_minimum_required(VERSION 3.0.2)
project(rosrect-listener-agent)
find_package(catkin REQUIRED COMPONENTS
roscpp
roslib
rosgraph_msgs
std_msgs
)
set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/)
find_package(OpenSSL REQUIRED)
find_package(cpprestsdk REQUIRED)
add_library(rosrect-listener-agent-lib src/backend_api.cpp src/robot_event.cpp src/state_manager.cpp)
target_link_libraries(rosrect-listener-agent-lib ${catkin_LIBRARIES} cpprestsdk::cpprest)
add_executable(rosrect-listener-agent src/listener_agent.cpp )
target_link_libraries(rosrect-listener-agent
${catkin_LIBRARIES}
rosrect-listener-agent-lib
cpprestsdk::cpprest
)
add_dependencies(rosrect-listener-agent ${rosrect-listener-agent_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
#############
## Testing ##
#############
if(CATKIN_ENABLE_TESTING AND ENABLE_COVERAGE_TESTING)
find_package(code_coverage REQUIRED)
# Add compiler flags for coverage instrumentation before defining any targets
APPEND_COVERAGE_COMPILER_FLAGS()
endif()
if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
# Unit tests for utility classes as just gtest
catkin_add_gtest(backend_test_node test/utests_backendapi.cpp)
catkin_add_gtest(robotevent_test_node test/utests_robotevent.cpp)
catkin_add_gtest(statemanager_test_node test/utests_statemanager.cpp)
# Integration test for listener agent node as rostest
add_rostest_gtest(listeneragent_test_node_ros test/listener_integration_test_ros.test test/itest_listeneragent_ros.cpp)
add_rostest_gtest(listeneragent_test_node_db test/listener_integration_test_db.test test/itest_listeneragent_db.cpp)
target_link_libraries(backend_test_node ${catkin_LIBRARIES} rosrect-listener-agent-lib cpprestsdk::cpprest)
target_link_libraries(robotevent_test_node ${catkin_LIBRARIES} rosrect-listener-agent-lib cpprestsdk::cpprest)
target_link_libraries(statemanager_test_node ${catkin_LIBRARIES} rosrect-listener-agent-lib cpprestsdk::cpprest)
target_link_libraries(listeneragent_test_node_ros ${catkin_LIBRARIES} rosrect-listener-agent-lib cpprestsdk::cpprest)
target_link_libraries(listeneragent_test_node_db ${catkin_LIBRARIES} rosrect-listener-agent-lib cpprestsdk::cpprest)
if(ENABLE_COVERAGE_TESTING)
set(COVERAGE_EXCLUDES "*/${PROJECT_NAME}/test*" "*/${PROJECT_NAME}/include/${PROJECT_NAME}/*.h")
add_code_coverage(
NAME ${PROJECT_NAME}_coverage_report
# DEPENDENCIES tests
)
endif()
endif()