Skip to content

Commit

Permalink
ADDED: a check for cmake version (#203)
Browse files Browse the repository at this point in the history
* ADDED: a check for cmake version

* Reuse a bit the code and add a comment

---------

Co-authored-by: Ignacio Vizzo <ignaciovizzo@gmail.com>
  • Loading branch information
NehilDanis and nachovizzo authored Aug 17, 2023
1 parent 2f60650 commit 06f7243
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
15 changes: 9 additions & 6 deletions cpp/kiss_icp/3rdparty/eigen/eigen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ include(FetchContent)
FetchContent_Declare(eigen URL https://github.com/nachovizzo/eigen/archive/refs/tags/3.4.90.tar.gz)
if(NOT eigen_POPULATED)
FetchContent_Populate(eigen)
add_subdirectory(${eigen_SOURCE_DIR} ${eigen_BINARY_DIR} SYSTEM EXCLUDE_FROM_ALL)
endif()

if(${CMAKE_VERSION} VERSION_LESS 3.25)
get_target_property(eigen_include_dirs eigen INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(eigen PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${eigen_include_dirs}")
if(${CMAKE_VERSION} GREATER_EQUAL 3.25)
add_subdirectory(${eigen_SOURCE_DIR} ${eigen_BINARY_DIR} SYSTEM EXCLUDE_FROM_ALL)
else()
# Emulate the SYSTEM flag introduced in CMake 3.25. Withouth this flag the compiler will
# consider this 3rdparty headers as source code and fail due the -Werror flag.
add_subdirectory(${eigen_SOURCE_DIR} ${eigen_BINARY_DIR} EXCLUDE_FROM_ALL)
get_target_property(eigen_include_dirs eigen INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(eigen PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${eigen_include_dirs}")
endif()
endif()
15 changes: 9 additions & 6 deletions cpp/kiss_icp/3rdparty/tbb/tbb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ include(FetchContent)
FetchContent_Declare(tbb URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.8.0.tar.gz)
if(NOT tbb_POPULATED)
FetchContent_Populate(tbb)
add_subdirectory(${tbb_SOURCE_DIR} ${tbb_BINARY_DIR} SYSTEM EXCLUDE_FROM_ALL)
endif()

if(${CMAKE_VERSION} VERSION_LESS 3.25)
get_target_property(tbb_include_dirs tbb INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(tbb PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${tbb_include_dirs}")
if(${CMAKE_VERSION} GREATER_EQUAL 3.25)
add_subdirectory(${tbb_SOURCE_DIR} ${tbb_BINARY_DIR} SYSTEM EXCLUDE_FROM_ALL)
else()
# Emulate the SYSTEM flag introduced in CMake 3.25. Withouth this flag the compiler will
# consider this 3rdparty headers as source code and fail due the -Werror flag.
add_subdirectory(${tbb_SOURCE_DIR} ${tbb_BINARY_DIR} EXCLUDE_FROM_ALL)
get_target_property(tbb_include_dirs tbb INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(tbb PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${tbb_include_dirs}")
endif()
endif()

0 comments on commit 06f7243

Please sign in to comment.