CMake does not produce .exe file

你说的曾经没有我的故事 提交于 2020-07-05 11:19:35

问题


I have built a CERN's ROOT script which based on c++ and i write(edit an example) CMakeList.txt. I am so rokie at CMake btw. When I command to compile with cmake .., it done correctly -i think- with no errors. But .exe file what i want to produce does not appear. My directory orders

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

There is my 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})

I do not get it where I am wrong.


回答1:


A typical scenario on a project which uses cmake is

cd src_directory   # for example  cd ~/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 ..       # (optional) skip this unless you need a GUI alternative to cmake where you can edit settings
cmake --build      # if you have a quad core CPU could use: make -j8 ... or make -j $(nproc) # on linux

then launch binary and confirm its OK then if desired install it using

sudo make install


来源:https://stackoverflow.com/questions/42881758/cmake-does-not-produce-exe-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!