vcpkg/ports/miniz/CMakeLists-targets.patch

56 lines
2.2 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3e453a..094a4e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,13 +8,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "")
CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
-
set(miniz_SOURCE miniz.c miniz_zip.c miniz_tinfl.c miniz_tdef.c)
-add_library(miniz ${miniz_SOURCE})
-target_include_directories(miniz PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
-
+add_library(miniz STATIC ${miniz_SOURCE})
+target_compile_definitions(miniz PRIVATE _CRT_SECURE_NO_WARNINGS)
+
+if(FALSE)
set(EXAMPLE1_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example1.c")
set(EXAMPLE2_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example2.c")
set(EXAMPLE3_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example3.c")
@@ -41,12 +40,28 @@ if(${UNIX})
target_link_libraries(example6 m)
endif()
+target_compile_definitions(example1 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example2 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example3 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example4 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example5 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example6 PRIVATE _CRT_SECURE_NO_WARNINGS)
+
# add_executable(miniz_tester ${MINIZ_TESTER_SRC_LIST})
# target_link_libraries(miniz_tester miniz)
+endif()
-install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
+install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+export(TARGETS ${PROJECT_NAME}
+ NAMESPACE miniz::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
+)
+install(EXPORT ${PROJECT_NAME}Config
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/miniz"
+ NAMESPACE miniz::
+)
file(GLOB INSTALL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
install(FILES ${INSTALL_HEADERS} DESTINATION include/${PROJECT_NAME})
\ No newline at end of file