Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake does not produce .exe file

Tags:

c++

cmake

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.

like image 927
agenel Avatar asked Mar 19 '17 01:03

agenel


1 Answers

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
like image 74
Scott Stensland Avatar answered Oct 26 '22 08:10

Scott Stensland