Make cmake recognize FetchContent subproject

This commit is contained in:
Vojtěch Šamla
2021-05-19 10:37:15 +02:00
parent 9edb278d22
commit 57176046b5

View File

@@ -1,5 +1,11 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
# determine whether this is a standalone project or included by other projects
set (MINIZ_STANDALONE_PROJECT ON)
if(DEFINED PROJECT_NAME)
set(MINIZ_STANDALONE_PROJECT OFF)
endif()
if(CMAKE_MINOR_VERSION LESS 12) if(CMAKE_MINOR_VERSION LESS 12)
project(miniz) project(miniz)
# see issue https://gitlab.kitware.com/cmake/cmake/merge_requests/1799 # see issue https://gitlab.kitware.com/cmake/cmake/merge_requests/1799
@@ -7,12 +13,6 @@ else()
project(miniz C) project(miniz C)
endif() endif()
# determine whether this is a standalone project or included by other projects
set(MINIZ_STANDALONE_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MINIZ_STANDALONE_PROJECT ON)
endif ()
set(MINIZ_API_VERSION 2) set(MINIZ_API_VERSION 2)
set(MINIZ_MINOR_VERSION 1) set(MINIZ_MINOR_VERSION 1)
set(MINIZ_PATCH_VERSION 0) set(MINIZ_PATCH_VERSION 0)