Skip to content

Commit 7ff8399

Browse files
committed
format
1 parent a5fd79c commit 7ff8399

File tree

2 files changed

+77
-76
lines changed

2 files changed

+77
-76
lines changed

CMakeLists.txt

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,75 +3,81 @@
33
#
44
# This file is part of eiquadprog.
55
#
6-
# eiquadprog is free software: you can redistribute it and/or modify
7-
# it under the terms of the GNU Lesser General Public License as published by
8-
# the Free Software Foundation, either version 3 of the License, or
9-
# (at your option) any later version.
6+
# eiquadprog is free software: you can redistribute it and/or modify it under
7+
# the terms of the GNU Lesser General Public License as published by the Free
8+
# Software Foundation, either version 3 of the License, or (at your option) any
9+
# later version.
1010
#
11-
# eiquadprog is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Lesser General Public License for more details.
11+
# eiquadprog is distributed in the hope that it will be useful, but WITHOUT ANY
12+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14+
# details.
1515
#
16-
# You should have received a copy of the GNU Lesser General Public License
17-
# along with eiquadprog. If not, see <https://www.gnu.org/licenses/>.
16+
# You should have received a copy of the GNU Lesser General Public License along
17+
# with eiquadprog. If not, see <https://www.gnu.org/licenses/>.
1818
#
1919

20-
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
20+
cmake_minimum_required(VERSION 3.1)
2121

2222
# Project properties
23-
SET(PROJECT_ORG stack-of-tasks)
24-
SET(PROJECT_NAME eiquadprog)
25-
SET(PROJECT_DESCRIPTION "C++ reimplementation of eiquadprog")
26-
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
23+
set(PROJECT_ORG stack-of-tasks)
24+
set(PROJECT_NAME eiquadprog)
25+
set(PROJECT_DESCRIPTION "C++ reimplementation of eiquadprog")
26+
set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
2727

2828
# Project options
29-
OPTION(TRACE_SOLVER "trace solver on stderr" OFF)
29+
option(TRACE_SOLVER "trace solver on stderr" OFF)
3030

3131
# Project configuration
32-
SET(PROJECT_USE_CMAKE_EXPORT TRUE)
33-
SET(CXX_DISABLE_WERROR TRUE)
34-
SET(CMAKE_VERBOSE_MAKEFILE TRUE)
35-
SET(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
32+
set(PROJECT_USE_CMAKE_EXPORT TRUE)
33+
set(CXX_DISABLE_WERROR TRUE)
34+
set(CMAKE_VERBOSE_MAKEFILE TRUE)
35+
set(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
3636

3737
# JRL-cmakemodule setup
38-
INCLUDE(cmake/base.cmake)
39-
INCLUDE(cmake/boost.cmake)
38+
include(cmake/base.cmake)
39+
include(cmake/boost.cmake)
4040

4141
# Project definition
42-
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
43-
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
42+
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
43+
project(${PROJECT_NAME} ${PROJECT_ARGS})
4444

4545
# Project dependencies
46-
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED)
47-
IF(BUILD_TESTING)
48-
FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
49-
ENDIF(BUILD_TESTING)
46+
add_project_dependency(Eigen3 REQUIRED)
47+
if(BUILD_TESTING)
48+
find_package(Boost REQUIRED COMPONENTS unit_test_framework)
49+
endif(BUILD_TESTING)
5050

5151
# Main Library
52-
SET(${PROJECT_NAME}_HEADERS
53-
include/${PROJECT_NAME}/eiquadprog.hpp
54-
include/${PROJECT_NAME}/eiquadprog-fast.hpp
55-
include/${PROJECT_NAME}/eiquadprog-rt.hpp
56-
include/${PROJECT_NAME}/eiquadprog-rt.hxx
57-
include/${PROJECT_NAME}/eiquadprog-utils.hxx
58-
)
52+
set(${PROJECT_NAME}_HEADERS
53+
include/${PROJECT_NAME}/eiquadprog.hpp
54+
include/${PROJECT_NAME}/eiquadprog-fast.hpp
55+
include/${PROJECT_NAME}/eiquadprog-rt.hpp
56+
include/${PROJECT_NAME}/eiquadprog-rt.hxx
57+
include/${PROJECT_NAME}/eiquadprog-utils.hxx)
5958

60-
ADD_LIBRARY(${PROJECT_NAME} SHARED
61-
src/eiquadprog-fast.cpp
62-
src/eiquadprog.cpp
63-
)
59+
add_library(${PROJECT_NAME} SHARED src/eiquadprog-fast.cpp src/eiquadprog.cpp)
6460

65-
IF(TRACE_SOLVER)
66-
ENDIF(TRACE_SOLVER)
67-
TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE EIQGUADPROG_TRACE_SOLVER)
61+
if(TRACE_SOLVER)
6862

69-
MODERNIZE_TARGET_LINK_LIBRARIES(${PROJECT_NAME} SCOPE PUBLIC
70-
TARGETS Eigen3::Eigen
71-
INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
72-
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} INTERFACE $<INSTALL_INTERFACE:include>)
73-
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
63+
endif(TRACE_SOLVER)
64+
target_compile_definitions(${PROJECT_NAME} PRIVATE EIQGUADPROG_TRACE_SOLVER)
7465

75-
IF(BUILD_TESTING)
76-
ADD_SUBDIRECTORY(tests)
77-
ENDIF(BUILD_TESTING)
66+
modernize_target_link_libraries(
67+
${PROJECT_NAME}
68+
SCOPE
69+
PUBLIC
70+
TARGETS
71+
Eigen3::Eigen
72+
INCLUDE_DIRS
73+
${EIGEN3_INCLUDE_DIR})
74+
target_include_directories(${PROJECT_NAME}
75+
INTERFACE $<INSTALL_INTERFACE:include>)
76+
install(
77+
TARGETS ${PROJECT_NAME}
78+
EXPORT ${TARGETS_EXPORT_NAME}
79+
DESTINATION lib)
80+
81+
if(BUILD_TESTING)
82+
add_subdirectory(tests)
83+
endif(BUILD_TESTING)

tests/CMakeLists.txt

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
11
#
22
# This file is part of eiquadprog.
33
#
4-
# eiquadprog is free software: you can redistribute it and/or modify
5-
# it under the terms of the GNU Lesser General Public License as published by
6-
# the Free Software Foundation, either version 3 of the License, or
7-
# (at your option) any later version.
4+
# eiquadprog is free software: you can redistribute it and/or modify it under
5+
# the terms of the GNU Lesser General Public License as published by the Free
6+
# Software Foundation, either version 3 of the License, or (at your option) any
7+
# later version.
88
#
9-
# eiquadprog is distributed in the hope that it will be useful,
10-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
# GNU Lesser General Public License for more details.
9+
# eiquadprog is distributed in the hope that it will be useful, but WITHOUT ANY
10+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11+
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12+
# details.
1313
#
14-
# You should have received a copy of the GNU Lesser General Public License
15-
# along with eiquadprog. If not, see <https://www.gnu.org/licenses/>.
14+
# You should have received a copy of the GNU Lesser General Public License along
15+
# with eiquadprog. If not, see <https://www.gnu.org/licenses/>.
1616
#
1717

18-
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
18+
add_definitions(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
1919

20-
#test paths and names (without .cpp extension)
21-
SET(TESTS
22-
eiquadprog-basic
23-
eiquadprog-fast
24-
eiquadprog-rt
25-
eiquadprog-both
26-
test-integration
27-
)
20+
# test paths and names (without .cpp extension)
21+
set(TESTS eiquadprog-basic eiquadprog-fast eiquadprog-rt eiquadprog-both
22+
test-integration)
2823

29-
FOREACH(test ${TESTS})
30-
ADD_UNIT_TEST(${test} ${test}.cpp)
31-
TARGET_LINK_LIBRARIES(${test} ${PROJECT_NAME} Boost::unit_test_framework)
32-
ENDFOREACH(test ${TESTS})
24+
foreach(test ${TESTS})
25+
add_unit_test(${test} ${test}.cpp)
26+
target_link_libraries(${test} ${PROJECT_NAME} Boost::unit_test_framework)
27+
endforeach(test ${TESTS})
3328

34-
ADD_LIBRARY(testab SHARED TestA.cpp TestB.cpp)
35-
TARGET_LINK_LIBRARIES(testab ${PROJECT_NAME})
36-
TARGET_LINK_LIBRARIES(test-integration testab)
29+
add_library(testab SHARED TestA.cpp TestB.cpp)
30+
target_link_libraries(testab ${PROJECT_NAME})
31+
target_link_libraries(test-integration testab)

0 commit comments

Comments
 (0)