Skip to content

Commit

Permalink
pre-commit run -a
Browse files Browse the repository at this point in the history
  • Loading branch information
ManifoldFR committed Oct 23, 2024
1 parent f743a57 commit b1fc1cf
Show file tree
Hide file tree
Showing 80 changed files with 3,446 additions and 2,087 deletions.
5 changes: 1 addition & 4 deletions .docs/examples/minimal-with-packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ add_project_dependency(Boost 1.50 REQUIRED COMPONENT timer)
add_library(myLibrary ${MY_SOURCES})
target_link_libraries(myLibrary MyDependency::MyAwesomeLib Boost::timer)

install(
TARGETS myLibrary
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
install(TARGETS myLibrary EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib)
207 changes: 107 additions & 100 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ project(
${PROJECT_NAME}
DESCRIPTION ${PROJECT_DESCRIPTION}
LANGUAGES CXX
VERSION 0.0.0)
VERSION 0.0.0
)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Generate CMake exports
Expand All @@ -20,111 +21,117 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Add a dummy library with a useful INTERFACE_INCLUDE_DIRECTORIES
add_library(${PROJECT_NAME} INTERFACE)
set(INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}")
target_include_directories(${PROJECT_NAME}
INTERFACE $<INSTALL_INTERFACE:${INSTALL_DIR}>)
target_include_directories(
${PROJECT_NAME}
INTERFACE $<INSTALL_INTERFACE:${INSTALL_DIR}>
)

# find . -maxdepth 1 -type d ! -path './.*' | sort
install(
DIRECTORY ./boost
./cython
./doxygen
./dynamic_graph
./find-external
./github
./gtest
./hpp
./image
./sphinx
./stubgen
./_unittests
DESTINATION ${INSTALL_DIR})
DIRECTORY
./boost
./cython
./doxygen
./dynamic_graph
./find-external
./github
./gtest
./hpp
./image
./sphinx
./stubgen
./_unittests
DESTINATION ${INSTALL_DIR}
)

# find . -maxdepth 1 -type f ! -path './.*' | sort
install(
FILES ./announce-gen
./apple.cmake
./base.cmake
./boost.cmake
./catkin.cmake
./CMakeLists.txt
./cmake_reinstall.cmake.in
./cmake_uninstall.cmake.in
./compiler.cmake
./componentConfig.cmake.in
./Config.cmake.in
./config.h.cmake
./config.hh.cmake
./coverage.cmake
./cpack.cmake
./createshexe.cmake
./cxx11.cmake
./cxx-standard.cmake
./debian.cmake
./deprecated.hh.cmake
./distcheck.cmake
./dist.cmake
./doxygen.cmake
./eigen.cmake
./filefilter.txt
./fix-license.sh
./geometric-tools.cmake
./git-archive-all.py
./git-archive-all.sh
./gitlog-to-changelog
./GNUInstallDirs.cmake
./gtest.cmake
./header.cmake
./hpp.cmake
./ide.cmake
./idl.cmake
./idlrtc.cmake
./install-data.cmake
./julia.cmake
./kineo.cmake
./lapack.cmake
./LICENSE
./logging.cmake
./man.cmake
./memorycheck_unit_test.cmake.in
./metapodfromurdf.cmake
./modernize-links.cmake
./msvc-specific.cmake
./msvc.vcxproj.user.in
./openhrp.cmake
./openhrpcontroller.cmake
./openrtm.cmake
./oscheck.cmake
./package-config.cmake
./pkg-config.cmake
./pkg-config.pc.cmake
./portability.cmake
./post-project.cmake
./pthread.cmake
./pyproject.py
./python.cmake
./python-helpers.cmake
./qhull.cmake
./README.md
./release.cmake
./relpath.cmake
./ros.cmake
./ros2.cmake
./sdformat.cmake
./setup.cfg
./shared-library.cmake
./sphinx.cmake
./stubs.cmake
./swig.cmake
./test.cmake
./tracy.cmake
./tracy.hh.cmake
./uninstall.cmake
./version.cmake
./version-script.cmake
./version-script-test.lds
./warning.hh.cmake
./xacro.cmake
DESTINATION ${INSTALL_DIR})
FILES
./announce-gen
./apple.cmake
./base.cmake
./boost.cmake
./catkin.cmake
./CMakeLists.txt
./cmake_reinstall.cmake.in
./cmake_uninstall.cmake.in
./compiler.cmake
./componentConfig.cmake.in
./Config.cmake.in
./config.h.cmake
./config.hh.cmake
./coverage.cmake
./cpack.cmake
./createshexe.cmake
./cxx11.cmake
./cxx-standard.cmake
./debian.cmake
./deprecated.hh.cmake
./distcheck.cmake
./dist.cmake
./doxygen.cmake
./eigen.cmake
./filefilter.txt
./fix-license.sh
./geometric-tools.cmake
./git-archive-all.py
./git-archive-all.sh
./gitlog-to-changelog
./GNUInstallDirs.cmake
./gtest.cmake
./header.cmake
./hpp.cmake
./ide.cmake
./idl.cmake
./idlrtc.cmake
./install-data.cmake
./julia.cmake
./kineo.cmake
./lapack.cmake
./LICENSE
./logging.cmake
./man.cmake
./memorycheck_unit_test.cmake.in
./metapodfromurdf.cmake
./modernize-links.cmake
./msvc-specific.cmake
./msvc.vcxproj.user.in
./openhrp.cmake
./openhrpcontroller.cmake
./openrtm.cmake
./oscheck.cmake
./package-config.cmake
./pkg-config.cmake
./pkg-config.pc.cmake
./portability.cmake
./post-project.cmake
./pthread.cmake
./pyproject.py
./python.cmake
./python-helpers.cmake
./qhull.cmake
./README.md
./release.cmake
./relpath.cmake
./ros.cmake
./ros2.cmake
./sdformat.cmake
./setup.cfg
./shared-library.cmake
./sphinx.cmake
./stubs.cmake
./swig.cmake
./test.cmake
./tracy.cmake
./tracy.hh.cmake
./uninstall.cmake
./version.cmake
./version-script.cmake
./version-script-test.lds
./warning.hh.cmake
./xacro.cmake
DESTINATION ${INSTALL_DIR}
)

install(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME})
endif()
10 changes: 7 additions & 3 deletions _unittests/catkin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ project(${PROJECT_NAME} LANGUAGES CXX)
# * Otherwise it is assumed it is created by the project and removed with the
# uninstall target

option(FORCE_DOT_CATKIN_CREATION
"Force creation of .catkin file in install destination" OFF)
option(
FORCE_DOT_CATKIN_CREATION
"Force creation of .catkin file in install destination"
OFF
)

if(FORCE_DOT_CATKIN_CREATION)
install(
CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_INSTALL_PREFIX}/.catkin)"
CODE
"execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_INSTALL_PREFIX}/.catkin)"
)
endif()
10 changes: 7 additions & 3 deletions _unittests/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ set(${PROJECT_NAME}_HEADERS include/jrl_cmakemodule/lib.hh)
add_library(jrl_cmakemodule_lib SHARED src/lib.cc)
target_include_directories(
jrl_cmakemodule_lib
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

install(
TARGETS jrl_cmakemodule_lib
EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
DESTINATION
lib
)

add_executable(jrl_cmakemodule_main src/main.cc)
target_link_libraries(jrl_cmakemodule_main jrl_cmakemodule_lib)
Expand Down
12 changes: 8 additions & 4 deletions _unittests/test_pkg-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,24 @@ endmacro()

unset_test_vars()
_parse_pkg_config_string("my-package > 0.4" PKG_LIB_NAME PKG_PREFIX
PKG_CONFIG_STRING_NOSPACE)
PKG_CONFIG_STRING_NOSPACE
)
expect_strequal("my-package" "${PKG_LIB_NAME}")
expect_strequal("MY_PACKAGE" "${PKG_PREFIX}")
expect_strequal("my-package>0.4" "${PKG_CONFIG_STRING_NOSPACE}")

unset_test_vars()
_parse_pkg_config_string("my-package >= 0.4" PKG_LIB_NAME PKG_PREFIX
PKG_CONFIG_STRING_NOSPACE)
PKG_CONFIG_STRING_NOSPACE
)
expect_strequal("my-package" "${PKG_LIB_NAME}")
expect_strequal("MY_PACKAGE" "${PKG_PREFIX}")
expect_strequal("my-package>=0.4" "${PKG_CONFIG_STRING_NOSPACE}")

unset_test_vars()
_parse_pkg_config_string("my-package" PKG_LIB_NAME PKG_PREFIX
PKG_CONFIG_STRING_NOSPACE)
PKG_CONFIG_STRING_NOSPACE
)
expect_strequal("my-package" "${PKG_LIB_NAME}")
expect_strequal("MY_PACKAGE" "${PKG_PREFIX}")
expect_strequal("my-package" "${PKG_CONFIG_STRING_NOSPACE}")
Expand All @@ -39,7 +42,8 @@ expect_strequal("my-package" "${PKG_CONFIG_STRING_NOSPACE}")
# with pkg-config's behavior.
unset_test_vars()
_parse_pkg_config_string("my-package>=0.4" PKG_LIB_NAME PKG_PREFIX
PKG_CONFIG_STRING_NOSPACE)
PKG_CONFIG_STRING_NOSPACE
)
expect_strequal("my-package>=0.4" "${PKG_LIB_NAME}")
expect_strequal("MY_PACKAGE__0_4" "${PKG_PREFIX}")
expect_strequal("my-package>=0.4" "${PKG_CONFIG_STRING_NOSPACE}")
8 changes: 6 additions & 2 deletions apple.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ macro(APPLY_DEFAULT_APPLE_CONFIGURATION)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
list(
FIND
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/lib"
isSystemDir
)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1")
Expand Down
Loading

0 comments on commit b1fc1cf

Please sign in to comment.