Skip to content
wizdzz edited this page Nov 15, 2019 · 2 revisions

Add Link Flag and ignore the order of input file

set(CMAKE_EXE_LINKER_FLAGS "-Wl,--start-group ${YOURFLAG}")
or
target_link_options(${YOUR_TARGET} PRIVATE|PUBLIC|INTERFACE "-Wl,--start-group ${YOURFLAG}")

Notice: Linker will go through the input files in order, finding undefined references and satisfying references that it saw before, so if the file that need link appear after the library, then it will occur undefined reference to xxx error, add -Wl,--start-group to tell linker ignore the order; Reference

target_link_options will add double quotes to the link command, and sometimes will link failed because of this.

Message output just at the first time

message([<mode>] "message to display")

The message is only output for the first time, unless use mode of SEND_ERROR or FATAL_ERROR.

Focus Make Things

Clone this wiki locally