From 446d52752161542bbb131d19414a491b1bcee049 Mon Sep 17 00:00:00 2001 From: Caleb Schilly Date: Mon, 5 Aug 2024 16:06:23 -0400 Subject: [PATCH 1/2] #99: wrap CMAKE_POSITION_INDEPENDENT_CODE in if statement --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 794141bb61..c6916a7472 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,17 +24,19 @@ set( set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -# add -fPIC to all targets -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use") +set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use") endif() message(STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}") option(VT_TV_PYTHON_BINDINGS_ENABLED "Build vt-tv with Python bindings" OFF) option(VT_TV_OPENMP_ENABLED "Build vt-tv with openMP support" ON) +# add -fPIC to all targets (if building with nanobind) +if(VT_TV_PYTHON_BINDINGS_ENABLED) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) +endif() + option(VT_TV_WERROR_ENABLED "Build vt-tv with warnings as errors" OFF) set(VT_TV_N_THREADS "2" CACHE STRING "Number of OpenMP threads to use") From 094b1088fb979e70975ecb5e3bd5d32318f426dd Mon Sep 17 00:00:00 2001 From: Caleb Schilly Date: Mon, 5 Aug 2024 16:59:40 -0400 Subject: [PATCH 2/2] #99: fix indentation error --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6916a7472..b6d58c6af5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) if(NOT CMAKE_CXX_STANDARD) -set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use") + set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use") endif() message(STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}")