cmake

Getting CMake to find flex on Windows

北战南征 提交于 2021-02-20 10:44:58
问题 I am trying to use flex on a project and I am trying to use CMake to link flex with my project. I found a FindFLEX.cmake online which I am using for this. You can find it here. This was supposed to be in CMake by default, but I dont think it was. My directory structure is as follows root ---src ---CMakeLists.txt ---cmake ---Modules ---FindFLEX.cmake ---build ---external ---flex - Where flex is installed ---bin ---flex.exe ---lib ---libfl.a My src/CMakeLists.txt is as follows cmake_minimum

Getting CMake to find flex on Windows

混江龙づ霸主 提交于 2021-02-20 10:36:44
问题 I am trying to use flex on a project and I am trying to use CMake to link flex with my project. I found a FindFLEX.cmake online which I am using for this. You can find it here. This was supposed to be in CMake by default, but I dont think it was. My directory structure is as follows root ---src ---CMakeLists.txt ---cmake ---Modules ---FindFLEX.cmake ---build ---external ---flex - Where flex is installed ---bin ---flex.exe ---lib ---libfl.a My src/CMakeLists.txt is as follows cmake_minimum

Getting CMake to find flex on Windows

人盡茶涼 提交于 2021-02-20 10:36:11
问题 I am trying to use flex on a project and I am trying to use CMake to link flex with my project. I found a FindFLEX.cmake online which I am using for this. You can find it here. This was supposed to be in CMake by default, but I dont think it was. My directory structure is as follows root ---src ---CMakeLists.txt ---cmake ---Modules ---FindFLEX.cmake ---build ---external ---flex - Where flex is installed ---bin ---flex.exe ---lib ---libfl.a My src/CMakeLists.txt is as follows cmake_minimum

Libtorch works with g++, but fails with Intel compiler

霸气de小男生 提交于 2021-02-19 09:31:23
问题 I want to use a neural network developed in Python (PyTorch) in a Fortran program. My OS is Ubuntu 18.04. What I am doing: save it as torchscript: TurbNN.pt call it from c++ program: call_ts.cpp, call_ts.h call c++ program from Fortran program (using bind©): main.f90 I successfully compiled the codes using CMake (3.19.4) and g++ (7.5.0). However, I cannot compile them using Intel compilers (HPCKit 2021.1.0.2684): # downloaded torchlib export Torch_DIR=/home/aiskhak/nn/fortran_calls

shared library error about “undefined symbol” when using `dlopen`

江枫思渺然 提交于 2021-02-19 07:44:25
问题 First thing first, here's my minimum reproducible program: CMakeLists.txt: cmake_minimum_required(VERSION 3.17) project(untitled4) set(CMAKE_CXX_STANDARD 17) add_library(lib1 SHARED lib1.cpp) add_executable(untitled4 main.cpp) target_link_libraries(untitled4 PRIVATE dl) main.cpp: #include "iostream" #include <dlfcn.h> int Test() { return 123456; } int main() { auto* handler = dlopen("/home/liu/source/untitled4/cmake-build-debug/liblib1.so", RTLD_LAZY|RTLD_GLOBAL); if (!handler) { std::cerr <<

Cmake zip folder but remove leading path

拥有回忆 提交于 2021-02-19 07:30:26
问题 I would like to zip folder in my project from CMake . For that I use following code snippet: ADD_CUSTOM_COMMAND ( TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E tar cvf ${ZIP_OUT_DIR}/my_archive.zip --format=zip -- ${FOLDER_TO_ZIP}/another_folder/ ) The problem with this code is that the files after unzipping contain path component ( ../../my_file.txt in my case). I tried to use tar cvf -C ${FOLDER_TO_ZIP}/another_folder but unfortunatelly CMake doesn't accept this option.

CMake cannot generate a safe linker search path - yocto 2.4

孤人 提交于 2021-02-19 06:05:24
问题 I have 2 yocto pkgs that can be successfully compiled with gcc 5.4, cmake 3.6.1 on yocto 2.0.2 but I'm facing the following issue with: gcc 6.3, cmake 3.6.1 on yocto 2.4 . After some research, I observed that yocto changed the sysroot structure (sysroot per package instead of a common sysroot). The error looks like this: CMake Warning at src/mytest/CMakeLists.txt:71 (add_executable): Cannot generate a safe linker search path for target mytest because files in some directories may conflict

CMake - Could NOT find Boost (missing: serialization) (found version “1.73.0”

自古美人都是妖i 提交于 2021-02-19 05:35:46
问题 I've been using Boost with my project for a while now, though until now, I'd only used the header-only libraries. I now want to use serialization, but when I try to add serialization as a REQUIRED component, I get the error written in the title. Here is my CMAKE file: cmake_minimum_required(VERSION 3.15) project(GinRummyCPP) SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "D:/Program Files/boost/boost_1_73_0") SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "D:/Program Files/boost/boost_1_73_0/libs

Cmake: linking to static internal library without exporting it

强颜欢笑 提交于 2021-02-19 04:36:12
问题 I have a project with this structure: /path/to/my/project ├── CMakeLists.txt ├── internal-libs │ ├── internal-lib1 ├── libs │ ├── lib1 │ ├── lib2 lib1 is a static library. lib2 is a static library. internal-lib1 is a static library. lib2 links statically to lib2 and internal-lib1. lib1 and lib2 are going to be exported but internal-lib1 will be left behind. For the linkage, I have: target_link_libraries(lib2 PRIVATE internal-lib1) target_link_libraries(lib2 PRIVATE lib1) My understanding is

Qt5 linux how to set window icon image

会有一股神秘感。 提交于 2021-02-19 04:01:29
问题 I have a UI I have designed in Qt designer and have written the code in c++. I am using catkin, which is just cmake, to build my project. Currently when the program is launched, the application icon looks like, .I would like to have that be an image that I specify, but have been unable to figure out how to get this to work. My project directory structure looks like the following package |--CMakeLists.txt |--src |--main.cpp |--MainWindow.cpp |--resources |--images |--kitty.png |--icons.qrc |-