From 5a038abf34285d5e83c84a11ab5d31b6b8272ccb Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 17 Jun 2022 15:09:50 +0200 Subject: [PATCH] Fix a CMake bad code https://cmake.org/cmake/help/latest/command/if.html#command:if > `if(ENV{some_var})` will always evaluate to false. --- Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake | 2 +- Installation/cmake/modules/FindTBB.cmake | 2 +- Mesh_3/examples/Mesh_3/CMakeLists.txt | 2 +- .../examples/Point_set_processing_3/CMakeLists.txt | 2 +- Polyhedron/demo/Polyhedron/CMakeLists.txt | 4 ++-- .../examples/Tetrahedral_remeshing/CMakeLists.txt | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake index a438c687650..4ea3d26e390 100644 --- a/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake +++ b/Installation/cmake/modules/CGAL_SetupCGALDependencies.cmake @@ -114,7 +114,7 @@ function(CGAL_setup_CGAL_dependencies target) target_link_libraries(${target} INTERFACE Threads::Threads) endif() - if(CGAL_USE_ASAN OR ENV{CGAL_USE_ASAN}) + if(CGAL_USE_ASAN OR "$ENV{CGAL_USE_ASAN}") set(CMAKE_DISABLE_FIND_PACKAGE_TBB TRUE CACHE BOOL "CGAL_USE_ASAN (AddressSanitizer) and TBB are incompatible") target_compile_options(${target} INTERFACE -fsanitize=address) target_link_options(${target} INTERFACE -fsanitize=address) diff --git a/Installation/cmake/modules/FindTBB.cmake b/Installation/cmake/modules/FindTBB.cmake index 8475edd450d..3cbea03d9b9 100644 --- a/Installation/cmake/modules/FindTBB.cmake +++ b/Installation/cmake/modules/FindTBB.cmake @@ -189,7 +189,7 @@ endmacro() # Now to actually find TBB # #start with looking for TBB_DIR and TBB_ROOT -if((TBB_ROOT OR ENV{TBB_ROOT} OR ENV{TBB_DIR} ) AND NOT TBB_FOUND) +if((TBB_ROOT OR "$ENV{TBB_ROOT}" OR "$ENV{TBB_DIR}" ) AND NOT TBB_FOUND) find_package(TBB QUIET NO_MODULE NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) endif() if(TBB_FOUND) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 48e219495d7..6f848c2c657 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -13,7 +13,7 @@ find_package(Boost) option(CGAL_ACTIVATE_CONCURRENT_MESH_3 "Activate parallelism in Mesh_3" OFF) -if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}) +if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR "$ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}") add_definitions(-DCGAL_CONCURRENT_MESH_3) find_package(TBB REQUIRED) include(CGAL_TBB_support) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt index 0e684584b13..c3ccee0d7a4 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt +++ b/Point_set_processing_3/examples/Point_set_processing_3/CMakeLists.txt @@ -39,7 +39,7 @@ endif() option(CGAL_ACTIVATE_CONCURRENT_PSP3 "Enable concurrency" OFF) set(CGAL_libs CGAL::CGAL) -if(CGAL_ACTIVATE_CONCURRENT_PSP3 OR ENV{CGAL_ACTIVATE_CONCURRENT_PSP3}) +if(CGAL_ACTIVATE_CONCURRENT_PSP3 OR "$ENV{CGAL_ACTIVATE_CONCURRENT_PSP3}") find_package(TBB REQUIRED) include(CGAL_TBB_support) if(TARGET CGAL::TBB_support) diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 7ee4cfeca01..68b0afc77d6 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -110,7 +110,7 @@ endif() option(CGAL_ACTIVATE_CONCURRENT_MESH_3 "Activate parallelism in Mesh_3" OFF) # And add -DCGAL_CONCURRENT_MESH_3 if that option is ON -if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}) +if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR "$ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}") add_definitions(-DCGAL_CONCURRENT_MESH_3) if(NOT TBB_FOUND) find_package(TBB REQUIRED) @@ -122,7 +122,7 @@ if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}) endif() endif() -else(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}) +else(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR "$ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}") option(LINK_WITH_TBB "Link with TBB anyway so we can use TBB timers for profiling" ON) if(LINK_WITH_TBB) diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt index 6332d0d424b..380b7ff60d7 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt @@ -24,7 +24,7 @@ include(CGAL_TBB_support) # Concurrent Mesh_3 option(CGAL_ACTIVATE_CONCURRENT_MESH_3 "Activate parallelism in Mesh_3" OFF) -if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}) +if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR "$ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}") add_definitions(-DCGAL_CONCURRENT_MESH_3) find_package(TBB REQUIRED) include(CGAL_TBB_support)