cmake

How to enable /INCREMENTAL:YES for release builds with cmake on Windows

不羁岁月 提交于 2020-01-25 02:07:13
问题 I need to use the linker flag /INCREMENTAL:YES when building some libraries with Visual Studio, but cmake seems to insist on using /INCREMENTAL:NO with release builds, and I can't figure out how to fix it. Some of the stuff that I've tried is set(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:YES") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:YES") set(CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES") set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:YES") set(CMAKE_CXX_FLAGS_RELEASE "

Unexpected path to libprotocd.lib after add gRPC::grpc++ library dependence in CMake

你离开我真会死。 提交于 2020-01-25 00:25:11
问题 I have a gRPC 1.23.0 compiled by conan(and all dependencies also resolved by conan). And I have a CMake project, that use grpc library: set (LIB_DEPS protobuf::libprotobuf gRPC::grpc++ ) target_link_libraries(${PROJECT_NAME} PUBLIC ${LIB_DEPS}) When I generate a VS project from this CMakeLists.txt in Linker - Input - Addition Dependencies property, I have there next value: C:\.conan\data\protobuf\3.9.1\kpa_conan\stable\package\b786e9ece960c3a76378ca4d5b0d0e922f4cedc1\lib\libprotobufd.lib <--

cmake 3.15 adding JOB_POOL to add_custom_command SOMETIMES

。_饼干妹妹 提交于 2020-01-24 22:50:34
问题 For users that are using cmake 3.15 or later and are also using Ninja as a generator, I want to set the new JOB_POOL argument to some large add_custom_command() blocks. For other users, I want to keep my add_custom_command() the same (no JOB_POOL). In earlier steps, I check the version and the generator and set ${JOB_POOLS} and I also set a variable such that users who should use a pool will see (something like): For historical reasons, I leave this here, although @Tsyvarev points out that

Cmake : find protobuf package in custom directory

孤人 提交于 2020-01-24 22:43:09
问题 I have cmake 3.10.x and downloaded current protobuf sources 3.6.1. Using cmake I created bin directory "{PROTOBUF_SOURCE_DIR}/bin" where this library is successfully built. As the next step I would like to use this custom tree in my cmake based project. I have set ( Protobuf_USE_STATIC_LIBS ON ) find_package( Protobuf REQUIRED ) if ( Protobuf_FOUND ) message( STATUS "Protobuf version : ${Protobuf_VERSION}" ) message( STATUS "Protobuf include path : ${Protobuf_INCLUDE_DIRS}" ) message( STATUS

CMake boost imported targets

家住魔仙堡 提交于 2020-01-24 21:34:08
问题 Can you explain me how should I use something like Boost::headers in my CMake file? I tried to utilize it somehow but is seems to work in different manner than I understand it. cmake_minimum_required(VERSION 3.15) project(Test) find_package(Boost COMPONENTS asio REQUIRED) add_executable(test main.cpp) target_include_directories(test SYSTEM PUBLIC ${Boost_INCLUDE_DIR}) target_link_libraries(test PUBLIC Boost::headers) This example does not work. It is caused by COMPONENTS asio . ASIO seems to

Unexplainable error “Please use the /MD switch for _AFXDLL builds”

别等时光非礼了梦想. 提交于 2020-01-24 21:13:29
问题 I use VisualStudio2010 and CMake 2.8.12.1. I created a CMakeLists.txt for a MFC project. MFC capability was done by following lines in the CMake file: add_definitions(-D_AFXDLL) #enables MFC set(CMAKE_MFC_FLAG 2) #use shared MFC library Furthermore the project will be build with MD as runtime library (default). But now I want my project to be build as MT (which also requires to specify static MFC library). So I replaced the lines above with: add_definitions(-D_AFXDLL) #enables MFC set(CMAKE

CMAKE option to include a directory

会有一股神秘感。 提交于 2020-01-24 21:10:10
问题 am trying to compile OPENCV on ARM-linux based system. For this purpose I created a toolchain cmake file with the following options SET (CMAKE_SYSTEM_NAME Linux) SET (CMAKE_SYSTEM_VERSION 1) SET (CMAKE_SYSTEM_PROCESSOR arm) SET (CMAKE_C_COMPILER "/usr/local/arm/4.3.1-eabi-armv6/usr/bin/arm-linux-gcc") SET (CMAKE_CXX_COMPILER "/usr/local/arm/4.3.1-eabi-armv6/usr/bin/arm-linux-g++") SET (CMAKE_FIND_ROOT_PATH "/usr/local/arm/4.3.1-eabi-armv6/") SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) SET

Errors when building TensorFlow with CMake on Windows 10

青春壹個敷衍的年華 提交于 2020-01-24 20:48:26
问题 I am attempting a TensorFlow CMake build on Windows, but I'm running into problems. First, I run C:\work\tensorflow\tensorflow\contrib\cmake\build>cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release ^ More? -DSWIG_EXECUTABLE=C:/Program1/swigwin-3.0.12/swig.exe ^ More? -DPYTHON_EXECUTABLE=C:/Python3.5/python.exe ^ More? -DPYTHON_LIBRARIES=C:/Python3.5/libs/python35.lib ^ More? -Dtensorflow_ENABLE_GPU=ON ^ More? -DCUDNN_HOME="C:\Program1\cudnn\cuda" and get the output -- Building for: Visual Studio 14

How to configure CMake so that the generated Visual Studio project finds the executable?

拈花ヽ惹草 提交于 2020-01-24 20:47:38
问题 I'm trying to set up a project with CMake in Visual Studio 2017 on Windows. The CMakeLists.txt is pretty simple. I am just adding an executable with source files and I specify the linker language to C++. Then I run cmake in my build_64 folder and I get the generated VS solution containing ALL_BUILD, ZERO_CHECK and my actual project of course. I set it to be my start project and try to run it but then I get this error message: Unable to start program 'C:\Users...\Documents\MyProject\build_64

CMake can't find “FindLibUSB.cmake” in CMAKE_MODULE_PATH despite it being there

风流意气都作罢 提交于 2020-01-24 20:15:49
问题 In my CMakelists.txt file, I specify: set (CMAKE_MODULE_PATH “${<ProjectName>_SOURCE_DIR}/cmake_modules”) And in my project root directory, there's a subdirectory called cmake_modules with a file called FindLibUSB.cmake , but when I run cmake , I get the following error: By not providing "FindLibUSB.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "LibUSB", but CMake did not find one. Why can't it find the file? It seems to me it's