cmake

How to overwrite macro definition in CMake

杀马特。学长 韩版系。学妹 提交于 2021-01-27 21:40:51
问题 I am on Windows 10, Visual Studio 2015. Suppose I am building library A with CMakeLists looking like cmake_minimum_required(VERSION 3.7) project(A) set(DLLIMPORT "__declspec(dllimport)") set(DLLEXPORT "__declspec(dllexport)") set(PROJECT_SRCS ${PROJECT_SOURCE_DIR}/src/TestA.cpp) set(PROJECT_INCS ${PROJECT_SOURCE_DIR}/include/TestA.h) add_library(${PROJECT_NAME} SHARED ${PROJECT_SRCS} ${PROJECT_INCS}) target_compile_definitions(${PROJECT_NAME} INTERFACE WINDOWS_DLL_API=${DLLIMPORT}) target

CMake 3.11 Linking CUBLAS

好久不见. 提交于 2021-01-27 21:03:54
问题 How do I correctly link to CUBLAS in CMake 3.11 ? In particular, I'm trying to create a CMakeLists file for this code. CMakeLists file so far: cmake_minimum_required(VERSION 3.8 FATAL_ERROR) project(cmake_and_cuda LANGUAGES CXX CUDA) add_executable(mmul_2 mmul_2.cu) This gives multiple "undefined reference errors" to cublas and curand. 回答1: Found the solution which is to add this line in the end of the CMakeLists file: target_link_libraries(mmul_2 -lcublas -lcurand) 来源: https://stackoverflow

How do I know if find_package() succeeds in cmake?

我们两清 提交于 2021-01-27 18:33:55
问题 find_package(GTK) How can I make it output something so that I can know whether it finds something or not? Platform: windows XP 回答1: You can use the message command as in: FIND_PACKAGE(GTK) IF (${GTK_FOUND}) MESSAGE(STATUS "Found GTK.") ELSE (${GTK_FOUND}) MESSAGE(STATUS "Could not locate GTK.") ENDIF (${GTK_FOUND}) Or, if you want it to abort if GTK isn't found: FIND_PACKAGE(GTK) IF (${GTK_FOUND}) MESSAGE(STATUS "Found GTK.") ELSE (${GTK_FOUND}) MESSAGE(FATAL_ERROR "Could not locate GTK.")

Building cv_bridge Package with ROS Kinetic and Python3 ignoring Cmake Arguments

。_饼干妹妹 提交于 2021-01-27 18:17:52
问题 I'm trying to integrate a ROS package into our system for a research project and the cv_bridge package and python3 is needed in order to get the package working. Currently I can't get the cv_bridge package to build in python3 despite multiple steps, constantly builds in python2 directory. Working in Ubuntu 16.04 with ROS kinetic. Using python3.5 Error Message: [ERROR] [1563897986.999724]: bad callback: <function color_callback at 0x7f00ffa06598> Traceback (most recent call last): File "/opt

CMakeList file to generate LLVM bitcode file from C source file

喜欢而已 提交于 2021-01-27 16:55:03
问题 I am trying to generate LLVM bytecode file from a C source file (hello.c) using CMake. And below is my CMakeLists file. ###### CMakelists.txt ############ cmake_minimum_required(VERSION 2.8.9) set(CMAKE_C_COMPILER "clang") set(CMAKE_C_FLAGS "-emit-llvm") project (hello) add_executable(hello hello.c) I am new to CMake and not sure if this is the right way. I could not find any rules to make *.bc in the generated MakeFile . Please correct me here. I also tried "-save-temps" Considering this for

CMakeList file to generate LLVM bitcode file from C source file

谁说我不能喝 提交于 2021-01-27 16:47:13
问题 I am trying to generate LLVM bytecode file from a C source file (hello.c) using CMake. And below is my CMakeLists file. ###### CMakelists.txt ############ cmake_minimum_required(VERSION 2.8.9) set(CMAKE_C_COMPILER "clang") set(CMAKE_C_FLAGS "-emit-llvm") project (hello) add_executable(hello hello.c) I am new to CMake and not sure if this is the right way. I could not find any rules to make *.bc in the generated MakeFile . Please correct me here. I also tried "-save-temps" Considering this for

Using -fuse-ld=lld with Clang on macOS

元气小坏坏 提交于 2021-01-27 16:43:40
问题 I am using Clang 10 (not AppleClang) on macOS 10.15 and am trying to link with LLD by specifying -fuse-ld=lld in the CMake flags CMAKE_EXE_LINKER_FLAGS . However, I am getting the following error when I try to use LLD: The C++ compiler "/Users/XXX/llvm/bin/clang++" is not able to compile a simple test program. It fails with the following output: ld64.lld: warning: ignoring unknown argument: -platform_version ld64.lld: warning: ignoring unknown argument: -search_paths_first ld64.lld: warning:

Using -fuse-ld=lld with Clang on macOS

£可爱£侵袭症+ 提交于 2021-01-27 16:41:27
问题 I am using Clang 10 (not AppleClang) on macOS 10.15 and am trying to link with LLD by specifying -fuse-ld=lld in the CMake flags CMAKE_EXE_LINKER_FLAGS . However, I am getting the following error when I try to use LLD: The C++ compiler "/Users/XXX/llvm/bin/clang++" is not able to compile a simple test program. It fails with the following output: ld64.lld: warning: ignoring unknown argument: -platform_version ld64.lld: warning: ignoring unknown argument: -search_paths_first ld64.lld: warning:

using EXTRA_OECMAKE doesn't have any effect in cmake variable in bitbake recipe

元气小坏坏 提交于 2021-01-27 12:05:34
问题 I wanted to add my application in a yocto Image and I used this recipe: DESCRIPTION = "my application" SECTION = "examples" LICENSE = "CLOSED" PR = "r0" DEPENDS += "opencv" SRC_URI = "git://address/to/myApplication.git;protocol=https;tag=v0.1" inherit pkgconfig cmake after running bitbake my-application, I faced this error: fatal error: string: No such file or directory #include <string> I searched on the internet and I found that I need to pass this variable to my CMake in my recipe: EXTRA

How do I add QSerialPort Module into CMake?

自闭症网瘾萝莉.ら 提交于 2021-01-27 11:57:59
问题 I want to add QSerialPort Module into CMake. From my understanding, I need to add QT += serialport into *.pro. I only want to use CMake. So I try simple CMake file to compile but it has error. The QtCore is working as qDebug can display without any issue. The error I am getting is: undefined reference to `QSerialPort::QSerialPort(QObject*)' undefined reference to `QSerialPort::~QSerialPort()' undefined reference to `QSerialPort::~QSerialPort()' This is the simple main.cpp file. #include