nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1--- a/CMakeLists.txt
2+++ b/CMakeLists.txt
3@@ -3,26 +3,12 @@
4 project(ImageLOL VERSION 0.0)
5 set(CMAKE_CXX_STANDARD 20)
6 set(CMAKE_CXX_STANDARD_REQUIRED True)
7-include_directories("External/zlib" "External/libpng")
8 add_subdirectory("External/stb_image-cmake")
9
10-set(SKIP_INSTALL_ALL ON CACHE BOOL "")
11-add_subdirectory("External/zlib-no-examples")
12-
13-set(PNG_BUILD_ZLIB ON CACHE BOOL "")
14-link_libraries(zlibstatic)
15-get_target_property(ZLIB_INCLUDE_DIRECTORIES zlibstatic INCLUDE_DIRECTORIES)
16-include_directories(${ZLIB_INCLUDE_DIRECTORIES})
17-set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRECTORIES} CACHE PATH "")
18-set(PNG_SHARED OFF CACHE BOOL "")
19-set(PNG_EXECUTABLES OFF CACHE BOOL "")
20-add_subdirectory("External/libpng")
21-add_dependencies(png_static zlibstatic zlib)
22-add_dependencies(genfiles zlibstatic)
23-unset(SKIP_INSTALL_ALL CACHE)
24-get_target_property(LIBPNG_INCLUDE_DIRECTORIES png_static INCLUDE_DIRECTORIES)
25+find_package(PNG REQUIRED)
26+set(LIBPNG_INCLUDE_DIRECTORIES ${PNG_INCLUDE_DIRS})
27
28 add_subdirectory("imagelol")
29 add_executable(ImageLOL main.cpp)
30 target_include_directories(ImageLOL PRIVATE ${LIBPNG_INCLUDE_DIRECTORIES})
31-target_link_libraries(ImageLOL PRIVATE stb_image png_static zlibstatic libimagelol)
32+target_link_libraries(ImageLOL PRIVATE stb_image PNG::PNG libimagelol)