diff options
author | Brad King <brad.king@kitware.com> | 2014-03-26 17:24:36 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-03-26 17:24:36 (GMT) |
commit | 06c9f554495de7f56ba41d716fbc5cb27f7afcda (patch) | |
tree | cdeabe31335211a1f388ff7b306b440c8e0a6ee9 /Source | |
parent | ab07d383a967c49352e40036a4986225ab0bd7de (diff) | |
parent | 0cc42b871ab9c9153d839ab8fc55a6a887d55092 (diff) | |
download | CMake-06c9f554495de7f56ba41d716fbc5cb27f7afcda.zip CMake-06c9f554495de7f56ba41d716fbc5cb27f7afcda.tar.gz CMake-06c9f554495de7f56ba41d716fbc5cb27f7afcda.tar.bz2 |
Merge topic 'haiku-updates'
0cc42b87 Haiku: Fix compiler detection when using distcc
84603d80 Haiku: Enable CMake builtin ELF editor
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeLists.txt | 18 | ||||
-rw-r--r-- | Source/cmELF.cxx | 20 |
2 files changed, 38 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 762470f..27d099d 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -18,6 +18,23 @@ else() endif() if(HAVE_ELF_H) set(CMAKE_USE_ELF_PARSER 1) +elseif(HAIKU) + # On Haiku, we need to include elf32.h from the private headers + set(CMake_HAIKU_INCLUDE_DIRS + /boot/system/develop/headers/private/system + /boot/system/develop/headers/private/system/arch/x86 + ) + + set(CMAKE_REQUIRED_INCLUDES ${CMake_HAIKU_INCLUDE_DIRS}) + CHECK_INCLUDE_FILE("elf32.h" HAVE_ELF32_H) + unset(CMAKE_REQUIRED_INCLUDES) + + if(HAVE_ELF32_H) + set(CMAKE_USE_ELF_PARSER 1) + else() + unset(CMake_HAIKU_INCLUDE_DIRS) + set(CMAKE_USE_ELF_PARSER) + endif() else() set(CMAKE_USE_ELF_PARSER) endif() @@ -57,6 +74,7 @@ include_directories( ${CMAKE_EXPAT_INCLUDES} ${CMAKE_TAR_INCLUDES} ${CMAKE_COMPRESS_INCLUDES} + ${CMake_HAIKU_INCLUDE_DIRS} ) # let cmake know it is supposed to use it diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index bc1c25b..dc6772c 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -23,6 +23,26 @@ #if defined(__OpenBSD__) # include <stdint.h> # include <elf_abi.h> +#elif defined(__HAIKU__) +# include <elf32.h> +# include <elf64.h> + typedef struct Elf32_Ehdr Elf32_Ehdr; + typedef struct Elf32_Shdr Elf32_Shdr; + typedef struct Elf32_Sym Elf32_Sym; + typedef struct Elf32_Rel Elf32_Rel; + typedef struct Elf32_Rela Elf32_Rela; +# define ELFMAG0 0x7F +# define ELFMAG1 'E' +# define ELFMAG2 'L' +# define ELFMAG3 'F' +# define ET_NONE 0 +# define ET_REL 1 +# define ET_EXEC 2 +# define ET_DYN 3 +# define ET_CORE 4 +# define EM_386 3 +# define EM_SPARC 2 +# define EM_PPC 20 #else # include <elf.h> #endif |