cmake

Create tar archive with Cmake

荒凉一梦 提交于 2020-05-13 03:37:29
问题 I have used the *_OUTPUT_PATH variables in my CMakeLists.txt file to specify specific locations for my binaries and library files, and that seems to be working "automatically" I would like as part of a "build" for one final step to happen, which is to create a tarball of the binaries that output directory. What do I need to add to create a tar? 回答1: You can use a CMake custom target to invoke CMake in command mode and have it produce a tarball from the binaries in the output directory. Here

Generate Web Assembly from CMake Project with a Specified HTML Output

孤街醉人 提交于 2020-05-12 09:04:50
问题 I have a CMake Project that I want to compile to Web assembly. To do so I used the following commands from the base folder of the project: mkdir build cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/emsdk/emscripten/1.38.6/cmake/Modules/Platform/Emscripten.cmake -G "Unix Makefiles" This successfully (or at least I think) generates a .wasm file and a .js file as well as the various cmake and make files . I also want it to generate an html file, like you can with emcc (ie. emcc example.c

Generate Web Assembly from CMake Project with a Specified HTML Output

此生再无相见时 提交于 2020-05-12 09:04:24
问题 I have a CMake Project that I want to compile to Web assembly. To do so I used the following commands from the base folder of the project: mkdir build cd build cmake .. -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/emsdk/emscripten/1.38.6/cmake/Modules/Platform/Emscripten.cmake -G "Unix Makefiles" This successfully (or at least I think) generates a .wasm file and a .js file as well as the various cmake and make files . I also want it to generate an html file, like you can with emcc (ie. emcc example.c

Android Studio CMake - shared library missing libc++_shared.so? Can CMake bundle this?

隐身守侯 提交于 2020-05-11 04:30:06
问题 Now that Android Studio 2.2 is released officially, I'm migrating from my old ndk-build process to try and use CMake within AS. As I'm incorporating several codebases from within my company (that I can't edit) that make heavy use of C++11 code (including the dreaded std::to_string() method), the only way I can compile is with a select few configuration options - all of which I discovered earlier when beginning work with ndk-build. (see below) So everything compiles again and builds into the

cmake: target_link_libraries use static library not shared

核能气质少年 提交于 2020-05-11 03:57:48
问题 Is it possible to tell cmake to link against a static library instead of shared ? At the top of my CMakeLists.txt I have the following configured: set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) Later, I add a binary, and tell it to link against tcmalloc in release mode: target_link_libraries(${BIN_NAME} optimized tcmalloc_minimal) The resulting makefile links aginst the shared version of tcmalloc : $ make VERBOSE=1 | grep tcmalloc /usr/bin/c++ ... -Wl,-Bdynamic ltcmalloc

How to reinstall the latest cmake version?

无人久伴 提交于 2020-05-10 04:40:10
问题 I would like to install cmake the latest version, on Linux environment. I have cmake version 3.5 installed and is not supported by some applications. I tried to upgrade it by uninstalling the current version. But when I reinstall with sudo apt-get install cmake, I get the same version 3.5 re-installed. How do I install the latest version with sudo apt-get install ....? 回答1: As far as I know the best way to get the latest CMake version installed on any Linux is not by apt but using pip. Remove

Using cmake to create protobuf / grpc cc files

ε祈祈猫儿з 提交于 2020-05-10 04:36:11
问题 If I want to recreate the following protoc command in cmake: protoc -I ../proto/ --cpp_out=. service.proto I use the following lines in cmake: file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto") PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) If I instead want to recreate the protoc command below: protoc -I ../proto/ --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` service.proto In the case above I am not able to determine how to change the cmake file,

Using cmake to create protobuf / grpc cc files

蓝咒 提交于 2020-05-10 04:36:05
问题 If I want to recreate the following protoc command in cmake: protoc -I ../proto/ --cpp_out=. service.proto I use the following lines in cmake: file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto") PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) If I instead want to recreate the protoc command below: protoc -I ../proto/ --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` service.proto In the case above I am not able to determine how to change the cmake file,

What's the proper way to enable AddressSanitizer in CMake that works in Xcode

混江龙づ霸主 提交于 2020-05-10 03:46:17
问题 I've added AddressSanitizer flag as follow: set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") Everything builds and runs fine when using Unix Makefiles . The problem comes when generating the Xcode project, it just doesn't want to link because it cannot find the ASan library. I already found two solutions, but decided not to use them because they cannot be automated using just CMake: Adding -Wl,-undefined,dynamic_lookup to the linked flags, so it skips linking to dynamic libraries

What's the proper way to enable AddressSanitizer in CMake that works in Xcode

旧街凉风 提交于 2020-05-10 03:43:10
问题 I've added AddressSanitizer flag as follow: set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") Everything builds and runs fine when using Unix Makefiles . The problem comes when generating the Xcode project, it just doesn't want to link because it cannot find the ASan library. I already found two solutions, but decided not to use them because they cannot be automated using just CMake: Adding -Wl,-undefined,dynamic_lookup to the linked flags, so it skips linking to dynamic libraries