cmake: static: check for link file when editing
When trying to do the necessary edits to linklibs.rsp or link.txt for static linking, first check if the files were created by cmake, otherwise a fatal error is generated.
This commit is contained in:
parent
ebd2e74a8a
commit
5f38c0da8a
|
@ -1,5 +1,9 @@
|
||||||
file(READ CMakeFiles/visualboyadvance-m.dir/link.txt link_cmd)
|
set(link_cmd_file CMakeFiles/visualboyadvance-m.dir/link.txt)
|
||||||
|
|
||||||
string(REGEX REPLACE "-l(z|expat|X[^ ]+|xcb[^ ]*) " "-Wl,--whole-archive -l\\1 -Wl,--no-whole-archive " link_cmd ${link_cmd})
|
if(EXISTS ${link_cmd_file})
|
||||||
|
file(READ ${link_cmd_file} link_cmd)
|
||||||
|
|
||||||
file(WRITE CMakeFiles/visualboyadvance-m.dir/link.txt ${link_cmd})
|
string(REGEX REPLACE "-l(z|expat|X[^ ]+|xcb[^ ]*) " "-Wl,--whole-archive -l\\1 -Wl,--no-whole-archive " link_cmd ${link_cmd})
|
||||||
|
|
||||||
|
file(WRITE ${link_cmd_file} ${link_cmd})
|
||||||
|
endif()
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
file(READ CMakeFiles/visualboyadvance-m.dir/linklibs.rsp link_libs)
|
set(link_cmd_file CMakeFiles/visualboyadvance-m.dir/linklibs.rsp)
|
||||||
|
|
||||||
string(REPLACE "-Wl,-Bdynamic" "" link_libs ${link_libs})
|
if(EXISTS ${link_cmd_file})
|
||||||
|
file(READ ${link_cmd_file} link_libs)
|
||||||
|
|
||||||
file(WRITE CMakeFiles/visualboyadvance-m.dir/linklibs.rsp ${link_libs})
|
string(REPLACE "-Wl,-Bdynamic" "" link_libs ${link_libs})
|
||||||
|
|
||||||
|
file(WRITE ${link_cmd_file} ${link_libs})
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue