summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorDavid Coppa <dcoppa@openbsd.org>2013-06-21 11:13:35 +0200
committerBrad King <brad.king@kitware.com>2013-06-21 08:27:40 -0400
commit480e924daedee520d18c8a9c0b9823fef205b57a (patch)
tree854bc7b1ef667ea8939717b1e1431d1edbbc7654 /Source
parent9f160c5b0a7e0f821ca4737638edbebf0ed398be (diff)
downloadcmake-480e924daedee520d18c8a9c0b9823fef205b57a.tar.gz
OpenBSD: Enable ELF parsing and editing (#14241)
OpenBSD provides ELF ABI declarations in #include <stdint.h> #include <elf_abi.h> Teach the platform check and cmELF implementation to use these.
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt6
-rw-r--r--Source/cmELF.cxx7
2 files changed, 11 insertions, 2 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 1893167c24..67a633385c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -11,7 +11,11 @@
#=============================================================================
include(CheckIncludeFile)
# Check if we can build support for ELF parsing.
-CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H)
+if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
+ CHECK_INCLUDE_FILES("stdint.h;elf_abi.h" HAVE_ELF_H)
+else()
+ CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H)
+endif()
if(HAVE_ELF_H)
set(CMAKE_USE_ELF_PARSER 1)
else()
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 1158fc0c01..30de9a8a68 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -19,7 +19,12 @@
#include <cmsys/CPU.h>
// Include the ELF format information system header.
-#include <elf.h>
+#if defined(__OpenBSD__)
+# include <stdint.h>
+# include <elf_abi.h>
+#else
+# include <elf.h>
+#endif
#if defined(__sun)
# include <sys/link.h> // For dynamic section information
#endif