CMake: Add libdl and demangle support

This commit is contained in:
Jonathan G Rennison
2020-06-27 14:33:32 +01:00
parent 37e682cb07
commit a8c3ceb3c9
3 changed files with 43 additions and 0 deletions

18
cmake/FindDemangle.cmake Normal file
View File

@@ -0,0 +1,18 @@
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_FLAGS "")
check_cxx_source_compiles("
#include <cxxabi.h>
int main() {
int status = -1;
char *demangled = abi::__cxa_demangle(\"test\", 0, 0, &status);
return 0;
}"
DEMANGLE_FOUND
)
if (DEMANGLE_FOUND)
add_compile_options(
-DWITH_DEMANGLE
)
endif (DEMANGLE_FOUND)