vcpkg/ports/gklib/build-fixes.patch

88 lines
2.7 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9cd1b4b..a6b629e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.22)
project(GKlib C)
option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF)
@@ -22,10 +22,12 @@ if(UNIX)
target_link_libraries(GKlib m)
endif(UNIX)
-include_directories("test")
-add_subdirectory("test")
-
-install(TARGETS GKlib
- ARCHIVE DESTINATION lib/${LINSTALL_PATH}
- LIBRARY DESTINATION lib/${LINSTALL_PATH})
-install(FILES ${GKlib_includes} DESTINATION include/${HINSTALL_PATH})
+install(TARGETS GKlib EXPORT GKlibTargets
+ INCLUDES DESTINATION "include/GKlib"
+ )
+install(FILES ${GKlib_includes} DESTINATION "include/GKlib")
+install(FILES "win32/adapt.h" DESTINATION "include/GKlib/win32")
+install(EXPORT GKlibTargets FILE "GKlibTargets.cmake" DESTINATION "share/gklib")
+file(WRITE "${CMAKE_INSTALL_PREFIX}/share/gklib/GKlibConfig.cmake" [=[
+include("${CMAKE_CURRENT_LIST_DIR}/GKlibTargets.cmake")
+]=])
diff --git a/GKlibSystem.cmake b/GKlibSystem.cmake
index d83b208..8019067 100644
--- a/GKlibSystem.cmake
+++ b/GKlibSystem.cmake
@@ -16,7 +16,6 @@ option(GKRAND "enable GKRAND support" OFF)
# Add compiler flags.
if(MSVC)
- set(GKlib_COPTS "/Ox")
set(GKlib_COPTIONS "-DWIN32 -DMSC -D_CRT_SECURE_NO_DEPRECATE -DUSE_GKREGEX")
elseif(MINGW)
set(GKlib_COPTS "-DUSE_GKREGEX")
@@ -34,7 +33,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(GKlib_COPTIONS "${GKlib_COPTIONS} -fPIC")
endif(NOT MINGW)
# GCC warnings.
- set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label")
+ set(GKlib_COPTIONS "${GKlib_COPTIONS} -Wall -pedantic -Wno-unused-function -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-label")
elseif(${CMAKE_C_COMPILER_ID} MATCHES "Sun")
# Sun insists on -xc99.
set(GKlib_COPTIONS "${GKlib_COPTIONS} -xc99")
@@ -60,7 +59,7 @@ endif(OPENMP)
if(GDB)
set(GKlib_COPTS "${GKlib_COPTS} -g")
set(GKlib_COPTIONS "${GKlib_COPTIONS} -Werror")
-else()
+elseif(0)
set(GKlib_COPTS "-O3")
endif(GDB)
diff --git a/gk_arch.h b/gk_arch.h
index 8c8ac50..122e087 100644
--- a/gk_arch.h
+++ b/gk_arch.h
@@ -31,9 +31,9 @@
#endif
-#ifdef __MSC__
- #include "ms_stdint.h"
- #include "ms_inttypes.h"
+#ifdef __MSC__
+ #include <stdint.h>
+ #include <inttypes.h>
#include "ms_stat.h"
#include "win32/adapt.h"
#else
@@ -60,9 +60,4 @@ typedef ptrdiff_t ssize_t;
#define PTRDIFF_MAX INT64_MAX
#endif
-/* MSC does not have INFINITY defined */
-#ifndef INFINITY
-#define INFINITY FLT_MAX
-#endif
-
#endif