mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-21 18:17:10 +01:00
handle multiline arguments in makefile correctly
This commit is contained in:
parent
661f329e03
commit
f99b18d573
@ -9,7 +9,8 @@ function(extract_from_makefile PATTERN RETURN FILEPATH)
|
||||
string(REGEX MATCH "${PATTERN}" CONTENTS "${MAKEFILE_CONTENT}")
|
||||
set(CONTENTS ${CMAKE_MATCH_1})
|
||||
# Split string into list
|
||||
string(REGEX REPLACE "[ \t]+" ";" CONTENTS "${CONTENTS}")
|
||||
string(REGEX REPLACE "([\t ]+(\\\\\n)?)+" ";" CONTENTS "${CONTENTS}")
|
||||
string(REGEX REPLACE "[\t ]*\\\\\n[\t ]*;" "" CONTENTS "${CONTENTS}")
|
||||
if("${CONTENTS}" STREQUAL "")
|
||||
message(AUTHOR_WARNING "No match for \"${PATTERN}\" found in file ${FILEPATH}")
|
||||
endif()
|
||||
@ -19,8 +20,8 @@ endfunction(extract_from_makefile)
|
||||
|
||||
# Function to extract C sources from makefile
|
||||
function(extract_sources SUBFOLDER ALLSOURCES)
|
||||
extract_from_makefile("lib[a-zA-Z1-9_]*_la_SOURCES[ \t]*=[ \t]*([^\n]*)" SOURCEFILES "${SUBFOLDER}/Makefile.am")
|
||||
# Add the folder in front of the file names
|
||||
extract_from_makefile("lib[a-zA-Z1-9_]*_la_SOURCES[ \t]*=[ \t]*(((\\\\\n)?[^\n])*)" SOURCEFILES "${SUBFOLDER}/Makefile.am")
|
||||
# Add the folder in front of the file names
|
||||
string(REGEX REPLACE "([^;]+)" "${SUBFOLDER}/\\1" SOURCEFILES "${SOURCEFILES}")
|
||||
# Return
|
||||
set(${ALLSOURCES} ${${ALLSOURCES}} ${SOURCEFILES} PARENT_SCOPE)
|
||||
@ -28,7 +29,7 @@ endfunction(extract_sources)
|
||||
|
||||
set(SOURCES)
|
||||
set(CBLAS_SOURCES)
|
||||
extract_from_makefile("SUBDIRS = ([^\n]*)" FOLDERS "./Makefile.am")
|
||||
extract_from_makefile("SUBDIRS = (((\\\\\n)?[^\n])*)" FOLDERS "./Makefile.am")
|
||||
extract_sources("." SOURCES)
|
||||
foreach(DIR IN LISTS FOLDERS)
|
||||
if("${DIR}" STREQUAL "cblas")
|
||||
|
Loading…
x
Reference in New Issue
Block a user