Commit 03957924 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

cmake: set compiler flags for non-Windows platforms

Summary:
Update CMakeLists.txt to check the current platform, and to set compiler flags
correctly.  It now uses flags for Microsoft Visual Studio on Windows, and flags
for gcc or clang on all other platforms.  Previously it unconditionally used
MSVC flags.

Reviewed By: meyering

Differential Revision: D6710435

fbshipit-source-id: dbae3097bcadf1ee4a25879dd7770603387c0e4d
parent 3d9eb7ff
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")
function(apply_folly_compile_options_to_target THETARGET)
target_compile_options(${THETARGET}
PUBLIC
-g
-std=gnu++14
-fopenmp
-finput-charset=UTF-8
-fsigned-char
-faligned-new
-Werror
-Wall
-Wno-deprecated
-Wdeprecated-declarations
-Wno-error=deprecated-declarations
-Wno-sign-compare
-Wno-unused
-Wunused-label
-Wunused-result
-Wnon-virtual-dtor
-Wno-noexcept-type
PRIVATE
-D_REENTRANT
-D_GNU_SOURCE
)
endfunction()
......@@ -86,7 +86,11 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h
)
include(FollyCompiler)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
include(FollyCompilerMSVC)
else()
include(FollyCompilerUnix)
endif()
include(FollyFunctions)
# Main folly library files
......@@ -196,11 +200,21 @@ else()
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(FOLLY_LINK_LIBRARIES
${FOLLY_LINK_LIBRARIES}
Iphlpapi.lib
Ws2_32.lib
)
else()
set(FOLLY_LINK_LIBRARIES
${FOLLY_LINK_LIBRARIES}
dl
)
endif()
set(FOLLY_LINK_LIBRARIES
${FOLLY_LINK_LIBRARIES}
Iphlpapi.lib
Ws2_32.lib
${FOLLY_SHINY_DEPENDENCIES}
)
......
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