如何在可执行文件后立即设置CMAKE_STATIC_LINKER_FLAGS? [tcc-ar]

How set CMAKE_STATIC_LINKER_FLAGS immediately after the executable file? [tcc -ar]

如何设置CMAKE_STATIC_LINKER_FLAGS在CMakeLists.txt紧跟可执行文件之后?

例如: 我需要:

tcc.exe-arqc staticRun.lib CMakeFiles/staticRun.dir/utils/system.c.obj

但是在这个设置之后cmake:

set (CMAKE_AR C:/run/code/toolchains/c++/MinGW-tcc/bin/tcc.exe CACHE FILEPATH "" FORCE)

set (CMAKE_STATIC_LINKER_FLAGS -ar CACHE STRING "" FORCE)

像这样添加 -ar 键:

tcc.exe qc staticRun.lib CMakeFiles/staticRun.dir/utils/system.c.obj-ar

所以,构建静态库失败。

P.S.

tcc.exe -ar - 均值

Tools: create library : tcc -ar [rcsv] lib.a files

最简单的方法就是用自定义语义更改用于运行静态库的行:

set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> -ar qc <TARGET> <LINK_FLAGS> <OBJECTS>")