qtcreator 的使用
1、qtcreator 若使用cmake作为编译工具,则cmake默认使用的是ninja作为其generator,若要将ninja改成unix makefile作为cmake的generator,则在这里改:
Tools > Options > Kits > Kit
kits可以翻译为构建套件。
2、qtcreator里在cmake的时候打印传给cmake的-Dxxx 变量:
3、cmake 设置link的时候使用静态库的方法:
https://stackoverflow.com/questions/16991225/cmake-and-static-linking
#Dynamic/Shared Libs ... #Static start set_target_properties(icarus PROPERTIES LINK_SEARCH_START_STATIC 1) set_target_properties(icarus PROPERTIES LINK_SEARCH_END_STATIC 1) set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") #Static Libs ... #Set Linker flags set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
或者这种方法:
add_executable(main main.cpp)
target_link_libraries(main ${CMAKE_SOURCE_DIR}/libbingitup.a)
CMake favours passing the full path to link libraries, so assuming libbingitup.a is in ${CMAKE_SOURCE_DIR}
4、在command line里手动执行cmake的方式来编译qt项目:
$ mkdir build $ cmake -DCMAKE_PREFIX_PATH:STRING="/home/hzh/soft/softy/Qt5.14.2/5.14.2/gcc_64" .. $ make -j4
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
支付宝扫一扫捐赠
支付宝扫一扫捐赠
微信公众号: 共鸣圈
欢迎讨论,邮件: 924948$qq.com 请把$改成@
QQ群:263132197
QQ: 924948