From c6747438e0f459652a9673296056e7a0bab0c6f8 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 22 Apr 2016 19:39:23 +0000 Subject: [PATCH] CMake: properly invoke buildsystems of vendored libraries. Before this commit, running "make" would build e.g. zlib's tests and fail because they are not designed to work when zlib is included as a subproject. After this commit, EXCLUDE_FROM_ALL, which I did not know about, prevents any actions from being done by default in these subprojects. --- CMakeLists.txt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7495d32c..f784ceb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,13 +76,6 @@ message(STATUS "Using in-tree libdxfrw") add_subdirectory(extlib/libdxfrw) if(WIN32) - # We don't want any of the subprojects to install anything. - # We don't actually install anything on Windows (so overriding - # this is OK), but the combination of freetype's and png/zlib's - # CMakeLists.txt produces harmless but annoying CMake errors. - macro(install) - endmacro() - # Configure Freetype first. If done later, it will notice that # zlib is available, try to use it and promptly break on MSVC # in a very obscure way. Given that the only use of zlib, bzip2 @@ -93,7 +86,7 @@ if(WIN32) if(NOT FREETYPE_FOUND) message(STATUS "Using in-tree libfreetype") - add_subdirectory(extlib/libfreetype) + add_subdirectory(extlib/libfreetype EXCLUDE_FROM_ALL) set(FREETYPE_LIBRARY freetype) @@ -106,7 +99,7 @@ if(WIN32) if(NOT ZLIB_FOUND) message(STATUS "Using in-tree zlib") - add_subdirectory(extlib/zlib) + add_subdirectory(extlib/zlib EXCLUDE_FROM_ALL) message(STATUS "Using in-tree libpng") set(ZLIB_LIBRARY @@ -124,7 +117,7 @@ if(WIN32) set(SKIP_INSTALL_ALL ON) - add_subdirectory(extlib/libpng) + add_subdirectory(extlib/libpng EXCLUDE_FROM_ALL) set(PNG_LIBRARY png16_static)