This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZLIB: Update documentation and example
- Loading branch information
Showing
2 changed files
with
21 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
# Copyright (c) 2014, Ruslan Baratov | ||
# All rights reserved. | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
# Emulate HunterGate: | ||
# * https://github.com/hunter-packages/gate | ||
include("../common.cmake") | ||
|
||
project(download-zlib) | ||
|
||
# download gtest | ||
# DOCUMENTATION_START { | ||
hunter_add_package(ZLIB) | ||
|
||
# now gtest can be used | ||
find_package(ZLIB CONFIG REQUIRED) | ||
|
||
add_executable(foo main.c) | ||
target_link_libraries(foo ZLIB::zlib) | ||
|
||
# Compatibility mode | ||
find_package(ZLIB REQUIRED) | ||
string(COMPARE EQUAL "${ZLIB_INCLUDE_DIRS}" "" is_empty) | ||
if(is_empty) | ||
message(FATAL_ERROR "Expected non-empty") | ||
endif() | ||
|
||
string(COMPARE EQUAL "${ZLIB_LIBRARIES}" "ZLIB::zlib" is_good) | ||
if(NOT is_good) | ||
message(FATAL_ERROR "Expected ZLIB::zlib but not ${ZLIB_LIBRARIES}") | ||
endif() | ||
add_executable(boo main.c) | ||
target_link_libraries(boo PRIVATE ZLIB::zlib) | ||
# DOCUMENTATION_END } | ||
|
||
include_directories("${ZLIB_INCLUDE_DIRS}") | ||
target_link_libraries(foo ${ZLIB_LIBRARIES}) | ||
# DOCUMENTATION_START_1 { | ||
add_executable(baz main.c) | ||
target_link_libraries(baz PRIVATE ZLIB::ZLIB) | ||
# DOCUMENTATION_END_1 } |