Commit 15fff7c1 authored by Matthew Glazar's avatar Matthew Glazar Committed by Facebook Github Bot

Don't clobber CXXFLAGS/CMAKE_CXX_FLAGS (#1046)

Summary:
CMake allows the user to add additional compilation options using
CXXFLAGS= or -DCMAKE_CXX_FLAGS=. For example, each of the following
commands would enable GCC security features in generated code:

    $ CXXFLAGS=-fstack-protector-strong cmake .
    $ cmake -DCMAKE_CXX_FLAGS=-fstack-protector-strong .

Unfortunately, this doesn't work with folly's build system; CXXFLAGS and
CMAKE_CXX_FLAGS are ignored. This makes it harder for package managers
to tweak folly's compilation.

Teach folly to respect user-supplied compiler flags instead of
overriding them.
Pull Request resolved: https://github.com/facebook/folly/pull/1046

Reviewed By: wez

Differential Revision: D14383310

Pulled By: yfeldblum

fbshipit-source-id: a6c527fa1659b93bb88a4e0be617a5d9022489dd
parent 2d22dfe3
......@@ -15,8 +15,8 @@ set(
mark_as_advanced(CXX_STD)
set(CMAKE_CXX_FLAGS_COMMON "-g -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_COMMON}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_COMMON} -O3")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COMMON}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_COMMON} -O3")
# Note that CMAKE_REQUIRED_FLAGS must be a string, not a list
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=${CXX_STD}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment