2017-09-22 14 views
0

私はジェネリック実装としてビルド時にjemallocライブラリを自分のアプリケーションにリンクしようとしています。 https://github.com/jemalloc/jemalloc/wiki/Getting-Startedによると、使用するリンクフラグは以下のとおりです。cmakeを使用してjemalloc共有ライブラリをリンクする方法

cmake_minimum_required(VERSION 2.8.12.2) 
project(widget) 
include_directories(include) 
file(GLOB SOURCES "src/*.cpp") 
add_executable(widget ${SOURCES}) 
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L`jemalloc-config --libdir` -Wl,-rpath,`jemalloc-config --libdir` -ljemalloc `jemalloc-config --libs`") 

しかし、私はmakeを行うとき、私は、次のエラー取得:

-L`jemalloc-config --libdir` -Wl,-rpath,`jemalloc-config --libdir` -ljemalloc `jemalloc-config --libs` 

だから私は、次のCMakeLists.txtをした

Linking CXX executable widget 
c++: error: `jemalloc-config: No such file or directory 
c++: error: unrecognized command line option ‘--libdir`’ 
c++: error: unrecognized command line option ‘--libdir`’ 
c++: error: unrecognized command line option ‘--libs`’ 
make[2]: *** [widget] Error 1 
make[1]: *** [CMakeFiles/widget.dir/all] Error 2 

答えて

1

execute_process()コマンドはあなたの友人です。実行可能ファイルjemalloc-configを実行し、その出力をCMake変数に入れます。

関連する問題