mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-01 13:14:42 +00:00
Replace bundled zlib, libpng, and stb with system libraries via a patch file. Some of bundled libraries fail to build on clang. This also removes the broken flag on darwin.
33 lines
1.3 KiB
Diff
33 lines
1.3 KiB
Diff
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -3,26 +3,12 @@
|
|
project(ImageLOL VERSION 0.0)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
-include_directories("External/zlib" "External/libpng")
|
|
add_subdirectory("External/stb_image-cmake")
|
|
|
|
-set(SKIP_INSTALL_ALL ON CACHE BOOL "")
|
|
-add_subdirectory("External/zlib-no-examples")
|
|
-
|
|
-set(PNG_BUILD_ZLIB ON CACHE BOOL "")
|
|
-link_libraries(zlibstatic)
|
|
-get_target_property(ZLIB_INCLUDE_DIRECTORIES zlibstatic INCLUDE_DIRECTORIES)
|
|
-include_directories(${ZLIB_INCLUDE_DIRECTORIES})
|
|
-set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRECTORIES} CACHE PATH "")
|
|
-set(PNG_SHARED OFF CACHE BOOL "")
|
|
-set(PNG_EXECUTABLES OFF CACHE BOOL "")
|
|
-add_subdirectory("External/libpng")
|
|
-add_dependencies(png_static zlibstatic zlib)
|
|
-add_dependencies(genfiles zlibstatic)
|
|
-unset(SKIP_INSTALL_ALL CACHE)
|
|
-get_target_property(LIBPNG_INCLUDE_DIRECTORIES png_static INCLUDE_DIRECTORIES)
|
|
+find_package(PNG REQUIRED)
|
|
+set(LIBPNG_INCLUDE_DIRECTORIES ${PNG_INCLUDE_DIRS})
|
|
|
|
add_subdirectory("imagelol")
|
|
add_executable(ImageLOL main.cpp)
|
|
target_include_directories(ImageLOL PRIVATE ${LIBPNG_INCLUDE_DIRECTORIES})
|
|
-target_link_libraries(ImageLOL PRIVATE stb_image png_static zlibstatic libimagelol)
|
|
+target_link_libraries(ImageLOL PRIVATE stb_image PNG::PNG libimagelol)
|