libdwarf-lite/patches/CMakeLists.patch

240 lines
6.9 KiB
Diff

--- CMakeLists.txt 2023-11-13 10:57:07.278246800 -0500
+++ CMakeListsUpdated.txt 2023-11-13 11:11:35.551623300 -0500
@@ -11,7 +11,7 @@
macro(msvc_posix target)
if(MSVC AND ("${MSVC_VERSION}" LESS 1900))
# under VS 2015
- target_compile_definitions(${target} PUBLIC
+ target_compile_definitions(${target} PUBLIC
snprintf=_snprintf)
endif()
endmacro()
@@ -36,7 +36,7 @@
if (LIBDWARF_CRT STREQUAL "MT")
message(STATUS "Using MT runtime by compile flag replacement")
# taken from the CMake FAQ
- foreach(flag_v
+ foreach(flag_v
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO
@@ -102,7 +102,7 @@
include(CheckSymbolExists)
### Version also appears in configure.ac
set(VERSION 0.9.0)
-set(PACKAGE_VERSION "\"${VERSION}\"")
+set(PACKAGE_VERSION "\"${VERSION}\"")
set(PACKAGE_NAME "libdwarf" )
set(PACKAGE_STRING "\"${PACKAGE_NAME} ${VERSION}\"")
string(REGEX REPLACE "[\"]" "" tarname1 "${PACKAGE_STRING}" )
@@ -114,83 +114,87 @@
set ( WORDS_BIGENDIAN 1 )
endif()
-check_include_file( "sys/types.h" HAVE_SYS_TYPES_H)
-check_include_file( "sys/stat.h" HAVE_SYS_STAT_H )
-check_include_file( "inttypes.h" HAVE_INTTYPES_H )
-check_include_file( "memory.h" HAVE_MEMORY_H )
-check_include_file( "strings.h" HAVE_STRINGS_H )
+# check_include_file( "sys/types.h" HAVE_SYS_TYPES_H) // Only used by dwarfgen
+# check_include_file( "sys/stat.h" HAVE_SYS_STAT_H ) // Only used by dwarfgen
+# check_include_file( "inttypes.h" HAVE_INTTYPES_H ) // Unused
+# check_include_file( "memory.h" HAVE_MEMORY_H ) // Unused
+# check_include_file( "strings.h" HAVE_STRINGS_H ) // Unused
check_include_file( "stdint.h" HAVE_STDINT_H )
check_include_file( "unistd.h" HAVE_UNISTD_H )
-check_include_file( "sgidefs.h" HAVE_SGIDEFS_H )
+# check_include_file( "sgidefs.h" HAVE_SGIDEFS_H ) // Unused
check_include_file( "stdafx.h" HAVE_STDAFX_H )
-check_include_file( "fcntl.h" HAVE_FCNTL_H )
+check_include_file( "fcntl.h" HAVE_FCNTL_H )
### cmake provides no way to guarantee uint32_t present.
### configure does guarantee that.
-if(HAVE_STDINT_H)
- check_c_source_compiles("
- #include <stdint.h>
- int main()
- {
- uintptr_t i; i = 12;
- return (int)i;
- }" HAVE_UINTPTR_T)
- check_c_source_compiles("
- #include <stdint.h>
- int main()
- {
- intptr_t i; i = 12;
- return (int)i;
- }" HAVE_INTPTR_T)
-endif()
-if (HAVE_UINTPTR_T)
- message(STATUS "HAVE_UINTPTR_T 1: uintptr_t defined in stdint.h... YES")
-else()
- message(STATUS "uintptr_t defined in stdint.h... NO")
- set(uintptr_t "unsigned long long int" )
- message(STATUS "Setting #define uintptr_t " ${uintptr_t})
-endif()
-if (uintptr_t)
- message(STATUS "uintptr_t value considered YES ")
-else()
- message(STATUS "uintptr_t value considered NO ")
-endif()
-if (HAVE_INTPTR_T)
- message(STATUS "HAVE_INTPTR_T 1: intptr_t defined in stdint.h... YES")
-else()
- message(STATUS "intptr_t defined in stdint.h... NO")
- set(uintptr_t "long long int" )
- message(STATUS "Setting #define intptr_t " ${intptr_t})
-endif()
-if (intptr_t)
- message(STATUS "intptr_t value considered YES ")
-else()
- message(STATUS "intptr_t value considered NO ")
-endif()
-
-
-check_c_source_compiles("
- static unsigned foo( unsigned x,
- __attribute__ ((unused)) int y)
- {
- unsigned x2 = x + 1;
- return x2;
- }
-
- int main(void) {
- unsigned y = 0;
- y = foo(12,y);
- return 0;
- }" HAVE_UNUSED_ATTRIBUTE)
-message(STATUS "Checking compiler supports __attribute__ unused... ${HAVE_UNUSED_ATTRIBUTE}")
-
-check_c_source_compiles([=[
- #include "stdafx.h"
- int main()
- {
- int p; p = 27;
- return 0;
- }]=] HAVE_STDAFX_H)
+# HAVE_UINTPTR_T: Unused
+# uintptr_t: Unused
+# HAVE_INTPTR_T: Unused
+# if(HAVE_STDINT_H)
+# check_c_source_compiles("
+# #include <stdint.h>
+# int main()
+# {
+# uintptr_t i; i = 12;
+# return (int)i;
+# }" HAVE_UINTPTR_T)
+# check_c_source_compiles("
+# #include <stdint.h>
+# int main()
+# {
+# intptr_t i; i = 12;
+# return (int)i;
+# }" HAVE_INTPTR_T)
+# endif()
+# if (HAVE_UINTPTR_T)
+# message(STATUS "HAVE_UINTPTR_T 1: uintptr_t defined in stdint.h... YES")
+# else()
+# message(STATUS "uintptr_t defined in stdint.h... NO")
+# set(uintptr_t "unsigned long long int" )
+# message(STATUS "Setting #define uintptr_t " ${uintptr_t})
+# endif()
+# if (uintptr_t)
+# message(STATUS "uintptr_t value considered YES ")
+# else()
+# message(STATUS "uintptr_t value considered NO ")
+# endif()
+# if (HAVE_INTPTR_T)
+# message(STATUS "HAVE_INTPTR_T 1: intptr_t defined in stdint.h... YES")
+# else()
+# message(STATUS "intptr_t defined in stdint.h... NO")
+# set(uintptr_t "long long int" )
+# message(STATUS "Setting #define intptr_t " ${intptr_t})
+# endif()
+# if (intptr_t)
+# message(STATUS "intptr_t value considered YES ")
+# else()
+# message(STATUS "intptr_t value considered NO ")
+# endif()
+
+# Unused
+# check_c_source_compiles("
+# static unsigned foo( unsigned x,
+# __attribute__ ((unused)) int y)
+# {
+# unsigned x2 = x + 1;
+# return x2;
+# }
+
+# int main(void) {
+# unsigned y = 0;
+# y = foo(12,y);
+# return 0;
+# }" HAVE_UNUSED_ATTRIBUTE)
+# message(STATUS "Checking compiler supports __attribute__ unused... ${HAVE_UNUSED_ATTRIBUTE}")
+
+# Redundant
+# check_c_source_compiles([=[
+# #include "stdafx.h"
+# int main()
+# {
+# int p; p = 27;
+# return 0;
+# }]=] HAVE_STDAFX_H)
#message(STATUS "Checking have windows stdafx.h... ${HAVE_STDAFX_H}")
set(CMAKE_REQUIRED_LIBRARIES z)
@@ -223,7 +227,7 @@
return 0;
} ]=] HAVE_ZLIB_H )
set(CMAKE_REQUIRED_LIBRARIES)
-if (HAVE_ZLIB)
+if (HAVE_ZLIB)
# For linking in libz
set(DW_FZLIB "z")
endif()
@@ -264,21 +268,21 @@
endif()
-
-check_c_source_compiles([=[
-#include <stdint.h>
-int main()
-{
- intptr_t p;
- p = 27;
- return 0;
-}]=] HAVE_INTPTR_T)
+# Unused
+# check_c_source_compiles([=[
+# #include <stdint.h>
+# int main()
+# {
+# intptr_t p;
+# p = 27;
+# return 0;
+# }]=] HAVE_INTPTR_T)
message(STATUS "CMAKE_SIZEOF_VOID_P ... " ${CMAKE_SIZEOF_VOID_P} )
-# libdwarf
+# libdwarf
option(BUILD_NON_SHARED "build archive library libdwarf[p].a" TRUE)
-option(BUILD_SHARED
+option(BUILD_SHARED
"build shared library libdwarf[p].so and use it" FALSE)
# This adds compiler option -Wall (gcc compiler warnings)
@@ -300,7 +304,7 @@
# unset(DW_LIBDWARF_STATIC)
#endif()
-option(BUILD_DWARFDUMP "Build dwarfdump (default is YES)" TRUE)
+option(BUILD_DWARFDUMP "Build dwarfdump (default is YES)" FALSE)
option(BUILD_DWARFGEN "Build dwarfgen (default is NO)" FALSE)
message(STATUS "Building dwarfgen ... ${BUILD_DWARFGEN}")