From 68854945c849322aa39c49d2e12681fac4532a20 Mon Sep 17 00:00:00 2001 From: Christopher Degawa Date: Fri, 24 Jan 2020 23:16:53 +0000 Subject: [PATCH] CMake: Copy source files into binary dir --- Project/CMake/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Project/CMake/CMakeLists.txt b/Project/CMake/CMakeLists.txt index 1efc635bb..9f1057cec 100644 --- a/Project/CMake/CMakeLists.txt +++ b/Project/CMake/CMakeLists.txt @@ -74,8 +74,13 @@ elseif(MSVC) else() set(MediaInfoLib_CONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/cmake/mediainfolib") endif() - -set(MediaInfoLib_SOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../Source) +if(MINGW) + # Work around for cmake generating extra long paths + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../../Source DESTINATION .) + set(MediaInfoLib_SOURCES_PATH ${CMAKE_CURRENT_BINARY_DIR}/Source) +else() + set(MediaInfoLib_SOURCES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../Source) +endif() # On Windows debug library should have 'd' postfix. if(WIN32) @@ -356,6 +361,10 @@ if(NOT TinyXML_FOUND) list(APPEND MediaInfoLib_SRCS ${MediaInfoLib_SOURCES_PATH}/ThirdParty/tinyxml2/tinyxml2.cpp) endif() +if(WIN32) + set_source_files_properties(${MediaInfoLib_SRCS} PROPERTIES GENERATED true) +endif() + add_library(mediainfo ${MediaInfoLib_SRCS}) target_include_directories(mediainfo INTERFACE ${INCLUDE_INSTALL_DIR})