]> granicus.if.org Git - gc/commitdiff
Fix passing CFLAGS_EXTRA to compiler in CMake script
authorIvan Maidanski <ivmai@mail.ru>
Tue, 30 Jul 2019 23:01:57 +0000 (02:01 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 30 Jul 2019 23:03:03 +0000 (02:03 +0300)
(fix of commit b6ac6a5a4)

The previous solution does not work for MS VC target.

* CMakeLists.txt [CFLAGS_EXTRA] (CMAKE_C_FLAGS, CMAKE_CXX_FLAGS): Do
not set.
* CMakeLists.txt [CFLAGS_EXTRA]: Pass $(CFLAGS_EXTRA) to
add_compile_options.

CMakeLists.txt

index 758fac790c4c3a1cd39ec9ba2c7e86ff76159bf7..e017f389a5bd7838a6e81dc4b6c67e1e43b4dd5c 100644 (file)
@@ -310,10 +310,7 @@ endif()
 
 # Extra user-defined flags to pass both to C and C++ compilers.
 if (DEFINED CFLAGS_EXTRA)
-  set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${CFLAGS_EXTRA})
-  if (enable_cplusplus)
-    set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CFLAGS_EXTRA})
-  endif()
+  add_compile_options(${CFLAGS_EXTRA})
 endif()
 
 add_library(gc ${SRC})