Skip to content

Commit

Permalink
Add CMake option to force using libc++ (#9570)
Browse files Browse the repository at this point in the history
Summary:
I've been unable to build HHVM master against libstdc++ with GCC 14 or clang 18. Since most distros use libstdc++ as the default C++ standard library, we need an option to force using libc++ instead.

Remove the existing option to force building against libstdc++ when using clang, which was added 10 years ago in
cc07cb5 to help workaround GCC 5 bugs and seems no longer relevant.

Pull Request resolved: #9570

Reviewed By: Wilfred

Differential Revision: D67921607

fbshipit-source-id: af895431d5a079b2c14f694dbeb1bc035b75899b
  • Loading branch information
mszabo-wikia authored and facebook-github-bot committed Jan 9, 2025
1 parent 68fbf37 commit df48bbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CMake/HPHPCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQU
endif()
endif()

if(CLANG_FORCE_LIBSTDCXX)
list(APPEND GENERAL_CXX_OPTIONS "stdlib=libstdc++")
if(CLANG_FORCE_LIBCPP)
list(APPEND GENERAL_CXX_OPTIONS "stdlib=libc++")
endif()
else() # using GCC
list(APPEND DISABLED_NAMED_WARNINGS
Expand Down
2 changes: 1 addition & 1 deletion CMake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ option(FORCE_TP_JEMALLOC "Always build and statically link jemalloc instead of u

option(ENABLE_HHPROF "Enable HHProf" OFF)

option(CLANG_FORCE_LIBSTDCXX "Force libstdc++ when building against Clang/LLVM" OFF)
option(CLANG_FORCE_LIBCPP "Force using libc++ as the C++ standard library" OFF)

option(USE_TCMALLOC "Use tcmalloc (if jemalloc is not used)" ON)
option(USE_GOOGLE_HEAP_PROFILER "Use Google heap profiler" OFF)
Expand Down

0 comments on commit df48bbf

Please sign in to comment.