cmake

CMake: Embed ELF into executable

谁说胖子不能爱 提交于 2020-01-22 09:58:09
问题 I have a project that needs access to an ELF file embedded into the executable in a special section. I was handcrafting Makefiles before and simply had a shell script where I used objcopy to copy the target I wanted to embed into an .o file, then link to this file in the executable. # Create a new section and copy the binary there ($1=input $2=output name) objcopy --input-target binary --output-target elf64-x86-64 \ --binary-architecture i386 $1 $2.o Now I want to get rid of the custom

CMake: Embed ELF into executable

*爱你&永不变心* 提交于 2020-01-22 09:57:26
问题 I have a project that needs access to an ELF file embedded into the executable in a special section. I was handcrafting Makefiles before and simply had a shell script where I used objcopy to copy the target I wanted to embed into an .o file, then link to this file in the executable. # Create a new section and copy the binary there ($1=input $2=output name) objcopy --input-target binary --output-target elf64-x86-64 \ --binary-architecture i386 $1 $2.o Now I want to get rid of the custom

CMake doesn't know where is Qt4 qmake

孤街醉人 提交于 2020-01-22 06:45:25
问题 I am using Debian OS and I'm trying to point to cmake where is my Qt4. I try to build qjson library and with its CMakeLists.txt: http://pastebin.com/fKNp0Qgy I get: Qt5 not found, searching for Qt4 qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory CMake Error at /usr/share/cmake-2.8/Modules/FindQt4.cmake:1386 (message): Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x Call Stack (most recent call first): CMakeLists.txt:55 (FIND

CMake doesn't know where is Qt4 qmake

岁酱吖の 提交于 2020-01-22 06:45:06
问题 I am using Debian OS and I'm trying to point to cmake where is my Qt4. I try to build qjson library and with its CMakeLists.txt: http://pastebin.com/fKNp0Qgy I get: Qt5 not found, searching for Qt4 qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory CMake Error at /usr/share/cmake-2.8/Modules/FindQt4.cmake:1386 (message): Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x Call Stack (most recent call first): CMakeLists.txt:55 (FIND

Setting default compiler in CMake

两盒软妹~` 提交于 2020-01-22 04:48:49
问题 I'm using CMake version 2.8 on WinXP SP3. Whenever i run my CMakeLists script by default CMake use Visual Studio 10 compiler. I've tried to do: SET( CMAKE_CXX_COMPILER "C:/MinGW/bin/g++" ) without success. How can i set MinGW as my default compiler so that i do not have to worry about setting compiler in the CMakeLists? 回答1: With CMake version 3.15 or later, you can set the CMAKE_GENERATOR environment variable to specify the default generator to be used on your system. 回答2: Under Windows

How to run MySQL/C++ Connector in CLion

独自空忆成欢 提交于 2020-01-22 02:30:31
问题 I want to run MySQL/C++ Connector in CLion IDE. I befor ran it in Visual Studio 2019 and it worked. I know that how to define MySQL/C++ Connector libraries in visual studio project but i dont know how to this in CLion. So how to run MySQL/C++ Connector in CLion , i mean how to declare MySQL/C++ Connector libraries and dll files in CLion. 来源: https://stackoverflow.com/questions/59799367/how-to-run-mysql-c-connector-in-clion

Using Eigen Lib in my Cmake project?

佐手、 提交于 2020-01-22 01:35:09
问题 I am having difficulty using a header-only library (Eigen) in my CMake project. When i take off all the portion related to Eigen library it compiles, but not sure how to build with (Eigen). Note that Eigen has a CmakeLists.txt in Eigen folder, and it has /src folder having (*.h and *.cpp) related to Matrix operation etc... The structure of my program is as follow Myproject (folder) is composed of : CmakeLists.txt /Build /Source The Source folder has bunch of my files (*.h and *.cpp) and the

日志输出 __FIFL__输出路径太长处理

十年热恋 提交于 2020-01-21 19:00:04
程序log日志打印时 __FIFL__输出路径太长处理 windows 项目属性-》c/c++ -》所有选项 使用完全路径 否 调试信息格式 程序数据库(Zi) Linux 如果是使用CMAKE编译的,在CMakeLists.txt中添加这么一行(C++语言需要将CMAKE_C_FLAGS换成CMAKE_CXX_FLAGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=‘\"$(subst ${CMAKE_SOURCE_DIR}/usrsctplib/netinet/,,$(abspath $<))\"‘") 如果使用的是GNU Makefile,则应该在相应的Makefile中添加如下行(C++语言需要将C_FLAGS换成CXX_FLAGS) C_FLAGS+=-D__FILENAME__=‘\"$(subst $(SOURCE_PREFIX)/,,$(abspath $<))\"‘ 同时源代码中,所有使用__FILE__的,替换成__FILENAME__宏。 来源: CSDN 作者: jlaij 链接: https://blog.csdn.net/chinabhlt/article/details/104061020

CMake: how do i depend on output from a custom target?

醉酒当歌 提交于 2020-01-21 13:57:37
问题 A traditional make process that I cannot modify produces a target on which I must do some post-processing. I use add_custom_target to force the makefile to always run. I use add_custom_command for my post-processing steps. The problem is that add_custom_target cannot produce an output as far as CMake is concerned. So, how do I setup a dependency for the post-processing steps? I don't want to run these steps unless the external make actually updated its target. The add_custom_command cannot

CMake: how do i depend on output from a custom target?

泪湿孤枕 提交于 2020-01-21 13:56:40
问题 A traditional make process that I cannot modify produces a target on which I must do some post-processing. I use add_custom_target to force the makefile to always run. I use add_custom_command for my post-processing steps. The problem is that add_custom_target cannot produce an output as far as CMake is concerned. So, how do I setup a dependency for the post-processing steps? I don't want to run these steps unless the external make actually updated its target. The add_custom_command cannot