diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 349350d33..46c5e0267 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -208,8 +208,13 @@ else() set(USE_PRECOMPILED_LIBS TRUE) endif() -# We don't CACHE for _DEPENDS variable, as the external project is only added when NOT _FOUND -# Use PARENT_SCOPE so they can still be used in other CMakeFiles +# We don't CACHE the _DEPENDS variables, as the external project is only added when NOT _FOUND +# and not in subsequent configures when _FOUND +# Use PARENT_SCOPE so they can still be used in other CMakeFiles. +macro(set_global NAME VALUE) + set(${NAME} ${VALUE}) + set(${NAME} ${VALUE} PARENT_SCOPE) +endmacro() if (NOT LIBUSB_FOUND AND NOT USE_PRECOMPILED_LIBS) # Cloning git repo doesn't include configure, so we download the bz2 which does @@ -221,7 +226,7 @@ if (NOT LIBUSB_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(libusb install_dir) - set(LIBUSB_DEPENDS libusb PARENT_SCOPE) + set_global(LIBUSB_DEPENDS libusb) set(LIBUSB_FOUND ON CACHE INTERNAL "") set(LIBUSB_EXTERNAL ON CACHE INTERNAL "") set(LIBUSB_INCLUDE_DIR "${install_dir}/include/libusb-1.0" CACHE INTERNAL "") @@ -243,7 +248,7 @@ if (NOT HIDAPI_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(hidapi install_dir) - set(HIDAPI_DEPENDS hidapi PARENT_SCOPE) + set_global(HIDAPI_DEPENDS hidapi) set(HIDAPI_FOUND ON CACHE INTERNAL "") set(HIDAPI_EXTERNAL ON CACHE INTERNAL "") set(HIDAPI_ROOT_DIR "${install_dir}" CACHE INTERNAL "") @@ -263,7 +268,7 @@ if (NOT OPUS_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(opus install_dir) - set(OPUS_DEPENDS opus PARENT_SCOPE) + set_global(OPUS_DEPENDS opus) set(OPUS_FOUND ON CACHE INTERNAL "") set(OPUS_EXTERNAL ON CACHE INTERNAL "") set(OPUS_INCLUDE_DIRS "${install_dir}/include" CACHE INTERNAL "") @@ -286,7 +291,7 @@ if (NOT ZLIB_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(zlib install_dir) - set(ZLIB_DEPENDS zlib PARENT_SCOPE) + set_global(ZLIB_DEPENDS zlib) set(ZLIB_FOUND ON CACHE INTERNAL "") set(ZLIB_EXTERNAL ON CACHE INTERNAL "") set(ZLIB_INCLUDE_DIRS "${install_dir}/include" CACHE INTERNAL "") @@ -308,7 +313,7 @@ if (NOT FAAD_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(faad source_dir binary_dir install_dir) - set(FAAD_DEPENDS faad PARENT_SCOPE) + set_global(FAAD_DEPENDS faad) set(FAAD_FOUND ON CACHE INTERNAL "") set(FAAD_EXTERNAL ON CACHE INTERNAL "") set(FAAD_INCLUDE_DIR "${install_dir}/include" CACHE INTERNAL "") @@ -332,7 +337,7 @@ if (NOT FFTW3F_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(fftw3f source_dir binary_dir) - set(FFTW3F_DEPENDS fftw3f PARENT_SCOPE) + set_global(FFTW3F_DEPENDS fftw3f) set(FFTW3F_FOUND ON CACHE INTERNAL "") set(FFTW3F_EXTERNAL ON CACHE INTERNAL "") set(FFTW3F_INCLUDE_DIRS "${source_dir}/api" "${binary_dir}" CACHE INTERNAL "") @@ -415,7 +420,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(x264 install_dir) - set(X264_DEPENDS x264 PARENT_SCOPE) + set_global(X264_DEPENDS x264) set(X264_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig") set(X264_FOUND ON CACHE INTERNAL "") set(X264_EXTERNAL ON CACHE INTERNAL "") @@ -433,7 +438,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(x265 install_dir) - set(X265_DEPENDS x265 PARENT_SCOPE) + set_global(X265_DEPENDS x265) set(X265_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig") set(X265_FOUND ON CACHE INTERNAL "") set(X265_EXTERNAL ON CACHE INTERNAL "") @@ -450,7 +455,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(fdk_aac install_dir) - set(FDK_AAC_DEPENDS fdk_aac PARENT_SCOPE) + set_global(FDK_AAC_DEPENDS fdk_aac) set(FDK_AAC_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig") set(FDK_AAC_FOUND ON CACHE INTERNAL "") set(FDK_AAC_EXTERNAL ON CACHE INTERNAL "") @@ -469,7 +474,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(mpg123 install_dir) - set(MPG123_DEPENDS mpg123 PARENT_SCOPE) + set_global(MPG123_DEPENDS mpg123) set(MPG123_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig") set(MPG123_FOUND ON CACHE INTERNAL "") set(MPG123_EXTERNAL ON CACHE INTERNAL "") @@ -489,7 +494,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(lame install_dir) - set(LAME_DEPENDS lame PARENT_SCOPE) + set_global(LAME_DEPENDS lame) # ffmpeg doesn't try to use pkg-config for lame, as it doesn't include a .pc file #set(LAME_PKG_CONFIG_DIR "${install_dir}/lib/pkgconfig") set(LAME_EXTRA_CFLAGS "-I${install_dir}/include") @@ -513,7 +518,7 @@ if (NOT FFMEG_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(ffmpeg install_dir) - set(FFMPEG_DEPENDS ffmpeg PARENT_SCOPE) + set_global(FFMPEG_DEPENDS ffmpeg) set(FFMPEG_INSTALL_DIR "${install_dir}") set(FFMPEG_FOUND ON CACHE INTERNAL "") set(FFMPEG_EXTERNAL ON CACHE INTERNAL "") @@ -545,7 +550,7 @@ if (NOT OpenCV_FOUND AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(opencv source_dir binary_dir) - set(OpenCV_DEPENDS opencv PARENT_SCOPE) + set_global(OpenCV_DEPENDS opencv) set(OpenCV_FOUND ON CACHE INTERNAL "") set(OpenCV_EXTERNAL ON CACHE INTERNAL "") set(OpenCV_INCLUDE_DIRS @@ -600,7 +605,7 @@ if ((NOT CODEC2_FOUND OR CODEC2_EXTERNAL) AND NOT USE_PRECOMPILED_LIBS) TEST_COMMAND "" ) ExternalProject_Get_Property(codec2 source_dir binary_dir) - set(CODEC2_DEPENDS codec2 PARENT_SCOPE) + set_global(CODEC2_DEPENDS codec2) set(CODEC2_FOUND ON CACHE INTERNAL "") set(CODEC2_EXTERNAL ON CACHE INTERNAL "") set(CODEC2_INCLUDE_DIR "${source_dir}/src" "${binary_dir}" CACHE INTERNAL "") @@ -641,7 +646,7 @@ if (NOT CM256CC_FOUND OR CM256CC_EXTERNAL) TEST_COMMAND "" ) ExternalProject_Get_Property(cm256cc source_dir binary_dir) - set(CM256CC_DEPENDS cm256cc PARENT_SCOPE) + set_global(CM256CC_DEPENDS cm256cc) set(CM256CC_FOUND ON CACHE INTERNAL "") set(CM256CC_EXTERNAL ON CACHE INTERNAL "") # we need cm256cc/library.h @@ -674,7 +679,7 @@ if ((NOT LIBDSDCC_FOUND OR LIBDSDCC_EXTERNAL) AND (NOT LIBMBE_FOUND OR LIBMBE_EX ) ExternalProject_Get_Property(mbelib source_dir binary_dir) set(USE_MBELIB ON) - set(DSDCC_DEPENDS mbelib PARENT_SCOPE) + set_global(DSDCC_DEPENDS mbelib) set(LIBMBE_FOUND ON CACHE INTERNAL "") set(LIBMBE_EXTERNAL ON CACHE INTERNAL "") set(LIBMBE_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "") @@ -705,7 +710,7 @@ if (NOT LIBSERIALDV_FOUND OR LIBSERIALDV_EXTERNAL) TEST_COMMAND "" ) ExternalProject_Get_Property(serialdv source_dir binary_dir) - set(DSDCC_DEPENDS ${DSDCC_DEPENDS} serialdv PARENT_SCOPE) + set_global(DSDCC_DEPENDS ${DSDCC_DEPENDS} serialdv) set(LIBSERIALDV_FOUND ON CACHE INTERNAL "") set(LIBSERIALDV_EXTERNAL ON CACHE INTERNAL "") set(LIBSERIALDV_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "") @@ -837,7 +842,7 @@ if (WIN32) TEST_COMMAND "" ) ExternalProject_Get_Property(pthreads4w source_dir binary_dir) - set(PTHREADS4W_DEPENDS pthreads4w PARENT_SCOPE) + set_global(PTHREADS4W_DEPENDS pthreads4w) set(PTHREADS4W_FOUND ON CACHE INTERNAL "") set(PTHREADS4W_EXTERNAL ON CACHE INTERNAL "") set(PTHREADS4W_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "") @@ -894,7 +899,7 @@ if (ZLIB_FOUND AND FAAD_FOUND) ) endif(WIN32) ExternalProject_Get_Property(dab source_dir binary_dir) - set(DAB_DEPENDS dab PARENT_SCOPE) + set_global(DAB_DEPENDS dab) set(DAB_FOUND ON CACHE INTERNAL "") set(DAB_EXTERNAL ON CACHE INTERNAL "") set(DAB_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/dab/src/dab" CACHE INTERNAL "") @@ -1334,7 +1339,7 @@ if (WIN32 OR APPLE) ) endif () ExternalProject_Get_Property(libxml2 source_dir binary_dir) - set(LIBXML2_DEPENDS libxml2 PARENT_SCOPE) + set_global(LIBXML2_DEPENDS libxml2) set(LIBXML2_FOUND ON CACHE INTERNAL "") set(LIBXML2_EXTERNAL ON CACHE INTERNAL "") set(LIBXML2_INCLUDE_DIR "${source_dir}/include" CACHE INTERNAL "")