Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/FBGEMM.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Burke <aaron@focuszonedevelopment.com>2020-09-03 03:40:11 +0300
committerGitHub <noreply@github.com>2020-09-03 03:40:11 +0300
commit055d2a099c829563aff1fffdeb4594ad8cfe5d99 (patch)
tree0dc1b2e0666030c7e2f72723019a300ff50a9e3a
parent8cb6f82b0f804add503eebd671dd211584a47b11 (diff)
Restore CMake 3.5.1 compatibility by reimplementing list(TRANSFORM...PREPEND) with a foreach() (#8)
-rw-r--r--CMakeLists.txt19
1 files changed, 16 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d4f8d4d..6e5dfa6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -131,11 +131,24 @@ if (NOT MSVC)
endif()
function(fixup_target TARGET TARGET_SOURCE_DIR)
- # ensure target correctly prefixes its public header with ${CMAKE_CURRENT_LIST_DIR},
+ # Ensure target correctly prefixes its public header with ${TARGET_SOURCE_DIR},
# which otherwise breaks installation targets including it as a submodule, so fix that
+
+ # We cannot use list(TRANSFORM...) since it wasn't added until 3.12 (and the PREPEND operation added in 3.15)
+ # and we need to maintain compatibility with 3.5.1, so implement it manually in a compatible way.
+ # We need to maintain 3.5.1 compatibility since it's what ships with Ubuntu 16.04 LTS
+ #list(TRANSFORM TARGET_PUBLIC_HEADERS PREPEND "${TARGET_SOURCE_DIR}/")
get_property(TARGET_PUBLIC_HEADER_PROP TARGET ${TARGET} PROPERTY PUBLIC_HEADER)
- list(APPEND TARGET_PUBLIC_HEADERS ${TARGET_PUBLIC_HEADER_PROP}) # Ensure it's a list
- list(TRANSFORM TARGET_PUBLIC_HEADERS PREPEND "${TARGET_SOURCE_DIR}/")
+ set(TARGET_PUBLIC_HEADERS "")
+ foreach(_FILE IN ITEMS ${TARGET_PUBLIC_HEADER_PROP})
+ # if the file is already in the target source dir, we can just use it as-is
+ if("${_FILE}" MATCHES "${TARGET_SOURCE_DIR}.*")
+ list(APPEND TARGET_PUBLIC_HEADERS ${_FILE})
+ else()
+ message(STATUS "Fixing ${TARGET} public header file path: ${_FILE} -> ${TARGET_SOURCE_DIR}/${_FILE}")
+ list(APPEND TARGET_PUBLIC_HEADERS "${TARGET_SOURCE_DIR}/${_FILE}")
+ endif()
+ endforeach()
set_property(TARGET ${TARGET} PROPERTY PUBLIC_HEADER ${TARGET_PUBLIC_HEADERS})
# ensure the target's interface include directories are only prefixed in the source directory