Skip to content

Commit

Permalink
cmake: add -libstd=libc++ for linux clang build
Browse files Browse the repository at this point in the history
This is needed to match the compile flags of the Unreal Engine
  • Loading branch information
bkueng committed Mar 2, 2017
1 parent 4cf3e59 commit a744c03
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmake/cmake-modules/CommonSetup.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Common setup instructions shared by all AirSim CMakeLists.

macro(CommonSetup)

find_package(Threads REQUIRED)

message(STATUS "Running CommonSetup...")

find_path(AIRSIM_ROOT NAMES AirSim.sln PATHS ".." "../.." "../../.." "../../../.." "../../../../.." "../../../../../..")
Expand All @@ -21,7 +24,13 @@ macro(CommonSetup)
else ()
##TODO: Werror removed temporarily. It should be added back after Linux build is stable
set(CMAKE_CXX_FLAGS "-std=c++14 -ggdb -lpthread -Wall -Wextra -Wstrict-aliasing -fmax-errors=2 -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option ${MAVLINK_OVERRIDES} ${BOOST_OVERRIDES} ${RPC_LIB_DEFINES} -ldl ${CMAKE_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ")

if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
# make sure to match the compiler flags with which the Unreal
# Engine is built with
set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi")
endif ()
endif ()
set(BUILD_PLATFORM "x64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand All @@ -31,8 +40,6 @@ macro(CommonSetup)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NXCOMPAT /DYNAMICBASE /INCREMENTAL:NO ")
ENDIF()

find_package(Threads REQUIRED)

## common boost settings to make sure we are all on the same page
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
Expand Down

0 comments on commit a744c03

Please sign in to comment.