From 85cbcbf7b0ea2c9ca40e871d011cf8686eb76388 Mon Sep 17 00:00:00 2001 From: David Scherba Date: Mon, 27 Nov 2017 15:55:50 -0600 Subject: [PATCH] draco: Fix add_cxx_preproc_definition() behavior/usage to support setting multiple opts - Prev, only last option would take/be appended ... results in needing to run build bunches of times and exploding the CMAKE_CXX_FLAGS variable - We also no longer cache those definitions, keeping them localized - Ref: https://github.com/google/draco/issues/306 for related discussion - Linked fix uses CMake add_definitions() function, but this applies to both C and C++-based compilation --- cmake/compiler_flags.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/compiler_flags.cmake b/cmake/compiler_flags.cmake index c9a25dc..8c2be6e 100644 --- a/cmake/compiler_flags.cmake +++ b/cmake/compiler_flags.cmake @@ -152,8 +152,7 @@ function (add_cxx_preproc_definition preproc_def) string(FIND "${CMAKE_CXX_FLAGS}" "${preproc_def}" PREPROC_DEF_FOUND) if (${PREPROC_DEF_FOUND} EQUAL -1) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" CACHE STRING "" - FORCE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" PARENT_SCOPE) endif () endfunction ()