From 908ef3e44ad37c087724553943aacb86f5f3804c Mon Sep 17 00:00:00 2001 From: Eugene Barnett Date: Sat, 5 May 2018 16:57:59 -0400 Subject: [PATCH] 1740 Issue - Enabling and Disabling importers -ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT will be respected by the macro --using local variable ASSIMP_IMPORTER_ENABLED to include or exclude --an importer -Fixes individual importer ex: set(ASSIMP_BUILD_FBX_IMPORTER OFF) -ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT is cached --if assimp is a child cmake project, need to force cache --from parent project --ex: set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT CACHE INTERNAL FALSE) --- code/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index d5d05db18..c8cc2fecd 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -208,8 +208,15 @@ OPTION(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT "default value of all ASSIMP_BUILD_ # macro to add the CMake Option ADD_ASSIMP_IMPORTER_ which enables compile of loader # this way selective loaders can be compiled (reduces filesize + compile time) MACRO(ADD_ASSIMP_IMPORTER name) - OPTION(ASSIMP_BUILD_${name}_IMPORTER "build the ${name} importer" ${ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT}) - IF(ASSIMP_BUILD_${name}_IMPORTER) + IF (ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT) + set(ASSIMP_IMPORTER_ENABLED TRUE) + IF (DEFINED ASSIMP_BUILD_${name}_IMPORTER AND NOT ASSIMP_BUILD_${name}_IMPORTER) + set(ASSIMP_IMPORTER_ENABLED FALSE) + ENDIF () + ELSE () + set(ASSIMP_IMPORTER_ENABLED ${ASSIMP_BUILD_${name}_IMPORTER}) + ENDIF () + IF (ASSIMP_IMPORTER_ENABLED) LIST(APPEND ASSIMP_LOADER_SRCS ${ARGN}) SET(ASSIMP_IMPORTERS_ENABLED "${ASSIMP_IMPORTERS_ENABLED} ${name}") SET(${name}_SRCS ${ARGN})