Skip to content

Commit

Permalink
Various CMake cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Jan 7, 2023
1 parent 6e752ed commit 9ffd959
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 39 deletions.
27 changes: 13 additions & 14 deletions orocos_kdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ ELSE ( NOT CMAKE_BUILD_TYPE )
MESSAGE( STATUS "Build type set to '${CMAKE_BUILD_TYPE}' by user." )
ENDIF ( NOT CMAKE_BUILD_TYPE )

IF(MSVC)
SET( KDL_CFLAGS "/W4 /WX" )
ELSE(MSVC)
SET( KDL_CFLAGS "-Wall -Werror=all -Wextra -Werror=extra" )
ENDIF(MSVC)
if(MSVC)
add_compile_options(/W4 /WX)
else(MSVC)
add_compile_options(-Wall -Werror=all -Wextra -Werror=extra)
endif(MSVC)

find_package(Eigen3 QUIET)
if(NOT EIGEN3_FOUND)
Expand All @@ -63,8 +63,7 @@ SET(KDL_CFLAGS "${KDL_CFLAGS} -I${EIGEN3_INCLUDE_DIR}")
# Check the platform STL containers capabilities
include(cmake/CheckSTLContainers.cmake)
CHECK_STL_CONTAINERS()

# Set the default option appropriately
# Set the default option accordingly
if(HAVE_STL_CONTAINER_INCOMPLETE_TYPES)
set(KDL_USE_NEW_TREE_INTERFACE_DEFAULT OFF)
else(HAVE_STL_CONTAINER_INCOMPLETE_TYPES)
Expand Down Expand Up @@ -120,7 +119,7 @@ include(CMakePackageConfigHelpers)
# Generate CMake package configuration
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/orocos_kdl-config.cmake.in
${PROJECT_BINARY_DIR}/orocos_kdl-config.cmake
INSTALL_DESTINATION share/orocos_kdl/cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/orocos_kdl
)

write_basic_package_version_file(
Expand All @@ -133,25 +132,25 @@ install(
FILES
${PROJECT_BINARY_DIR}/orocos_kdl-config.cmake
${PROJECT_BINARY_DIR}/orocos_kdl-config-version.cmake
DESTINATION share/orocos_kdl/cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/orocos_kdl
)

INSTALL(FILES cmake/FindEigen3.cmake DESTINATION share/orocos_kdl/cmake)
INSTALL(EXPORT OrocosKDLTargets DESTINATION share/orocos_kdl/cmake)
INSTALL(FILES cmake/FindEigen3.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/orocos_kdl)
INSTALL(EXPORT OrocosKDLTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/orocos_kdl)

# Generate pkg-config package configuration
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/orocos_kdl.pc.in
${PROJECT_BINARY_DIR}/orocos_kdl.pc
INSTALL_DESTINATION lib${LIB_SUFFIX}/pkgconfig
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/orocos_kdl.pc.in
${PROJECT_BINARY_DIR}/orocos-kdl.pc
INSTALL_DESTINATION lib${LIB_SUFFIX}/pkgconfig
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

install(
FILES
${PROJECT_BINARY_DIR}/orocos_kdl.pc
${PROJECT_BINARY_DIR}/orocos-kdl.pc
DESTINATION lib${LIB_SUFFIX}/pkgconfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
1 change: 0 additions & 1 deletion orocos_kdl/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ TARGET_INCLUDE_DIRECTORIES(orocos-kdl PUBLIC
SET_TARGET_PROPERTIES( orocos-kdl PROPERTIES
SOVERSION "${KDL_VERSION_MAJOR}.${KDL_VERSION_MINOR}"
VERSION "${KDL_VERSION}"
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS}"
PUBLIC_HEADER "${KDL_HPPS};${CMAKE_CURRENT_BINARY_DIR}/config.h"
)

Expand Down
32 changes: 8 additions & 24 deletions orocos_kdl/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,42 @@ IF(ENABLE_TESTS)

ADD_EXECUTABLE(framestest framestest.cpp test-runner.cpp)
TARGET_LINK_LIBRARIES(framestest orocos-kdl ${CPPUNIT})
SET(TESTNAME "framestest")
SET_TARGET_PROPERTIES( framestest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS} -DTESTNAME=\"\\\"${TESTNAME}\\\"\" ")
target_compile_definitions(framestest PRIVATE TESTNAME="framestest")
ADD_TEST(NAME framestest COMMAND framestest)

ADD_EXECUTABLE(kinfamtest kinfamtest.cpp test-runner.cpp)
TARGET_LINK_LIBRARIES(kinfamtest orocos-kdl ${CPPUNIT})
SET(TESTNAME "kinfamtest")
SET_TARGET_PROPERTIES( kinfamtest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS}")
target_compile_definitions(kinfamtest PRIVATE TESTNAME="kinfamtest")
ADD_TEST(NAME kinfamtest COMMAND kinfamtest)

ADD_EXECUTABLE(solvertest solvertest.cpp test-runner.cpp)
TARGET_LINK_LIBRARIES(solvertest orocos-kdl ${CPPUNIT})
SET(TESTNAME "solvertest")
SET_TARGET_PROPERTIES( solvertest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS} -DTESTNAME=\"\\\"${TESTNAME}\\\"\" ")
target_compile_definitions(solvertest PRIVATE TESTNAME="solvertest")
ADD_TEST(NAME solvertest COMMAND solvertest)

ADD_EXECUTABLE(inertiatest inertiatest.cpp test-runner.cpp)
TARGET_LINK_LIBRARIES(inertiatest orocos-kdl ${CPPUNIT})
SET(TESTNAME "inertiatest")
SET_TARGET_PROPERTIES( inertiatest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS} -DTESTNAME=\"\\\"${TESTNAME}\\\"\" ")
target_compile_definitions(inertiatest PRIVATE TESTNAME="inertiatest")
ADD_TEST(NAME inertiatest COMMAND inertiatest)

ADD_EXECUTABLE(jacobiantest jacobiantest.cpp test-runner.cpp)
SET(TESTNAME "jacobiantest")
TARGET_LINK_LIBRARIES(jacobiantest orocos-kdl ${CPPUNIT})
SET_TARGET_PROPERTIES( jacobiantest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS} -DTESTNAME=\"\\\"${TESTNAME}\\\"\" ")
target_compile_definitions(jacobiantest PRIVATE TESTNAME="jacobiantest")
ADD_TEST(NAME jacobiantest COMMAND jacobiantest)

ADD_EXECUTABLE(jacobiandottest jacobiandottest.cpp test-runner.cpp)
SET(TESTNAME "jacobiandottest")
TARGET_LINK_LIBRARIES(jacobiandottest orocos-kdl ${CPPUNIT})
SET_TARGET_PROPERTIES( jacobiandottest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS} -DTESTNAME=\"\\\"${TESTNAME}\\\"\" ")
target_compile_definitions(jacobiandottest PRIVATE TESTNAME="jacobiandottest")
ADD_TEST(NAME jacobiandottest COMMAND jacobiandottest)

ADD_EXECUTABLE(velocityprofiletest velocityprofiletest.cpp test-runner.cpp)
SET(TESTNAME "velocityprofiletest")
TARGET_LINK_LIBRARIES(velocityprofiletest orocos-kdl ${CPPUNIT})
SET_TARGET_PROPERTIES( velocityprofiletest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS} -DTESTNAME=\"\\\"${TESTNAME}\\\"\" ")
target_compile_definitions(velocityprofiletest PRIVATE TESTNAME="velocityprofiletest")
ADD_TEST(NAME velocityprofiletest COMMAND velocityprofiletest)

ADD_EXECUTABLE(treeinvdyntest treeinvdyntest.cpp test-runner.cpp)
SET(TESTNAME "treeinvdyntest")
TARGET_LINK_LIBRARIES(treeinvdyntest orocos-kdl ${CPPUNIT})
SET_TARGET_PROPERTIES( treeinvdyntest PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD} ${KDL_CFLAGS} -DTESTNAME=\"\\\"${TESTNAME}\\\"\" ")
target_compile_definitions(treeinvdyntest PRIVATE TESTNAME="treeinvdyntest")
ADD_TEST(NAME treeinvdyntest COMMAND treeinvdyntest)

# ADD_EXECUTABLE(rallnumbertest rallnumbertest.cpp)
Expand Down

0 comments on commit 9ffd959

Please sign in to comment.