cmake

Copy out plain .o files with cmake

三世轮回 提交于 2020-06-28 05:53:07
问题 I'm trying to get cmake (on linux) to create some static object (.o) files and install them to an external directory. To that end I have a list, object_sources , containing the project path of the sources, and put this in the top level CMakeLists.txt : set(local_objects "") foreach(file ${object_sources}) get_filename_component(cur ${file} NAME_WE) add_library("${cur}.o" OBJECT ${file}) list(APPEND local_objects "${cur}.o") # To confirm these variables are what I think they are: message("--->

C compiler broken: is not able to compile a simple test program

孤街醉人 提交于 2020-06-28 04:25:14
问题 On my Dektop and on my Surface Pro 6 CLion has stopped working and I don´t know exactly why. That is written on my Desktop: "C:\Program Files\JetBrains\CLion 2018.3.2\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\Alexander\Desktop\Clion\übung -- The C compiler identification is GNU 6.3.0 -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken CMake Error at C:/Program Files

linking sfml with cmake (Windows MinGW)

允我心安 提交于 2020-06-27 17:49:27
问题 I can't seem to link SFML to my executable using cmake . CMakeLists.txt: cmake_minimum_required(VERSION 3.0.0) project(Tut3) set(LIBS_DIR ~/../../Libraries) add_executable(Tut3 main.cpp) set(CMAKE_MODULE_PATH ${LIBS_DIR}/sfml/cmake/Modules) find_package(SFML REQUIRED system window graphics) target_link_libraries(Tut3 ${SFML_LIBRARIES}) Error I get when running cmake: CMake Error at C:/Libraries/sfml/cmake/Modules/FindSFML.cmake:355 (message): Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY

Is it possible not to generate ALL_BUILD project in cmake?

。_饼干妹妹 提交于 2020-06-27 15:09:32
问题 I don't need ALL_BUILD subproject, can I avoid generating it? Thanx. 回答1: CMake Issue #16979: "ALL_BUILD target being generated": The ALL_BUILD target corresponds to CMake's notion of the "all" target, equivalent to make all with makefile generators. This is different from "Build Solution" behavior due to idiosyncrasies in how the VS IDE deals with inter-vcxproj dependencies. There is no way to suppress the ALL_BUILD target. It must exist for commands like cmake --build . to be able to build

Getting source and destination must be different error while building project

你。 提交于 2020-06-27 11:49:10
问题 I am getting this error while building project. Trying to add a new library in android-studio. Is there anybody who has an idea basically I am trying to create a new library here. Options tried: Manually deleted build Invaildate cache/restart Gradle clean build cache Build->Clean Project But build is failing. Source C:\Users\abc\AndroidStudioProjects\Events\app\build\intermediates\cmake\debug\obj\armeabi-v7a\libnative-lib.so and destination C:\Users\abc\AndroidStudioProjects\Events\app\build

Linking dll/lib to a cmake project

此生再无相见时 提交于 2020-06-27 08:42:14
问题 I was trying to link a library to my cmake project but I was getting linker errors. I spent 2 hours trying to resolve the problem and I created simple project where I hardcoded all the paths. CMAKE_MINIMUM_REQUIRED(VERSION 3.0) PROJECT(Testing CXX) INCLUDE_DIRECTORIES("B:/Projects/TMH/Libraries/Awesomium/inc") SET(SOURCE_FILES src/Main.cpp src/Application.cpp src/Window.cpp ) ADD_EXECUTABLE(Testing ${SOURCE_FILES}) TARGET_LINK_LIBRARIES(Testing B:/Projects/TMH/Libraries/Awesomium/bin

CMake passes all gcc flags to nvcc as well

£可爱£侵袭症+ 提交于 2020-06-27 04:11:22
问题 My project uses cuda kernel for a small module and needs nvcc for compiling. During compilation, cmake pass the same linker and compiler flags intended for gcc to nvcc as well. In my particular case, I get the following error. nvcc fatal : Unknown option 'Wl,--no-as-needed' Following the accepted answer in this thread, I managed to remove the compiler flags for the target that needs nvcc as follows. get_target_property(_target_cxx_flags target_that_needs_nvcc COMPILE_OPTIONS) list(REMOVE_ITEM

CMake and PC-Lint Plus - how do I pass CMake's include directory list to Lint?

霸气de小男生 提交于 2020-06-26 12:51:07
问题 I'm trying to incorporate PC-Lint Plus into my cmake project, mainly per PC-Lint needs a list of all include paths for the files to be scanned. How to get a list of all include paths recursively needed by a target in CMake?. PC-Lint is getting invoked, but ends up dying because not all the includes are in the PC-Lint invocation. I dumped the above link into a Lint.cmake, and included that in my top level CMake file. In my project file, I added: if(COMMAND add_pc_lint) add_pc_lint(moded ${SRC

cmake linking against static libraries - do you have to tell cmake where to look?

折月煮酒 提交于 2020-06-26 09:44:48
问题 I've installed the c++ library pcapplusplus on my linux machine and the .a files have been put in /usr/local/lib . I am now trying to link my project with it in cmake using target_link_libraries(${PROJECT_NAME} libCommon++.a libPacket++.a libPcap++.a) . However, it can't find Packet.h which is part of libPacket++.a . What am I doing wrong here? Do I have to tell cmake where to look? cmake_minimum_required(VERSION 2.8.9) project(networksniffer) # The version number. set (networksniffer_VERSION

CMAKE 3.3.2: Set build type in CMakeLists.txt

好久不见. 提交于 2020-06-26 06:09:10
问题 Is there a way to set the build type from CMakeLists.txt? So that with (or without) generating a new makefile when I compile it should go with the release mode. I try something along the lines of: set(DCMAKE_BUILD_TYPE "Release") But it doesn't work (compiles in debug mode). This is on a linux system. Thanks. 回答1: It's simply: set(CMAKE_BUILD_TYPE "Release") 来源: https://stackoverflow.com/questions/34558795/cmake-3-3-2-set-build-type-in-cmakelists-txt