CMake不会生成.exe文件

时间:2017-03-19 01:07:07

标签: c++ cmake

我已经构建了一个CERN的ROOT脚本,该脚本基于c ++而我编写(编辑一个例子)CMakeList.txt。我是CMake btw的新手。 当我命令用cmake ..编译时,它正确地完成了 - 我认为 - 没有错误。但是.exe文件我想要生成的内容不会出现。 我的目录订单

/Project
../TLV.cpp  
../CMakeLists.txt
../build

有我的CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
project(TLV)
#Set CXX flags to compile with c++11 and error warnings quiet
set(CMAKE_CXX_FLAGS "-O3 -fPIC -Wall -Wextra -std=c++11 -m64")

#Load root 
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} $ENV{ROOTSYS}/etc/cmake)
#print conf
message(STATUS "Environmental CMAKE_MODULE_PATH is $ENV{ROOTSYS}")
#find the package with extra libraries needed
find_package(ROOT MODULE REQUIRED Cling TreePlayer Tree Rint Postscript Matrix RIO Core Foam RooStats RooFit RooFitCore Gpad Graf3d Graf Hist Net TMVA  XMLIO MLP)
#include ROOT stuff
include(${ROOT_USE_FILE})
message(STATUS "Environmental ROOTSYS is $ENV{ROOTSYS}")
message(STATUS "found root at: ${ROOT_USE_FILE}")
message(STATUS "ROOT_LIBRARIES=${ROOT_LIBRARIES}")


#produce executables in bin path
set(EXECUTABLE_OUTPUT_PATH bin)
#include_directories(./../Framework Headers)
#${FROM_OTHERS_INCLUDE})
#defines all .cpp support class with corresponding Headers
#file(GLOB SRCS Sources/*.cpp Headers/*.hpp )
#${FROM_OTHERS_HEADER} ${FROM_OTHERS_SOURCE})

#add executable 
add_executable( TLV    TLV.cpp  )

#link the executable with the root libraries
target_link_libraries(TLV ${ROOT_LIBRARIES})

我不知道我错了。

1 个答案:

答案 0 :(得分:2)

使用cmake的项目的典型场景是

cd src_directory   # for example  cd ~/other_src/root-6.08.06/
mkdir build        # skip this if dir build already exists
cd build
cmake ..           #  the .. just says your source home dir is up a dir
cmake-gui ..       #  a GUI alternative to cmake where you can edit settings
cmake --build      # if you have a quad core CPU could use: make -j8