Commit bd275d49 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

update cmake for compatibilty with root 6.14.

A libCubixCore.so library is now produced, and linked to the executable program Cubix
parent 994c5144
......@@ -5,11 +5,14 @@
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
set(CMAKE_INSTALL_MESSAGE LAZY)
#
# NAME OF THE PROGRAM : means main is in PROG_NAME.[c,cpp ...] and it gives exec with name PROG_NAME
#
SET(PROG_NAME Cubix)
SET(CMAKE_EXEC_LINKER_FLAGS -static)
SET(Lib_NAME CubixCore)
#
PROJECT(${PROG_NAME})
MESSAGE("[GW] + root/gui/${PROJECT_NAME}")
......@@ -18,7 +21,6 @@ MESSAGE("[GW] + root/gui/${PROJECT_NAME}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -Wno-unused-parameter -Wno-sign-compare -Wno-unused-but-set-variable" )
#Set ROOT
set (ROOT_FIND_COMPONENTS Core MathCore Hist Gui Gpad Graf RIO Matrix Physics Thread MultiProc Spectrum)
find_file(ROOT_CONFIG ROOTConfig.cmake HINTS $ENV{ROOTSYS} ${ROOTSYS} ${ROOT_DIR} NO_DEFAULT_PATH PATH_SUFFIXES cmake)
if (ROOT_CONFIG)
......@@ -53,40 +55,64 @@ IF (found_root_major_vers LESS 6)
MESSAGE( FATAL_ERROR "Invalid ROOT version \"${ROOTERSION}\", at least major version 6 is required, e.g. \"6.00/00\"")
ENDIF (found_root_major_vers LESS 6)
######################
### Link libraries ###
######################
# root
SET(EXTRA_EXTERNAL_LIBRARIES ${EXTRA_EXTERNAL_LIBRARIES} Core MathCore Hist Gui Gpad Graf RIO Matrix Physics Thread MultiProc Spectrum)
# gw
set (ALL_GW_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include ${ROOT_INCLUDES})
set(EXTRA_INTERNAL_LIBRARIES GWCORE GWPHYSICS GWTOOLS GWSYSTEM )
#
####################
### define files ###
####################
SET(SourceDir ${CMAKE_CURRENT_SOURCE_DIR}/src)
include_directories(${SourceDir})
#
# exe and list of required libraries
SET( PROG_NAME_SRCS ${SourceDir}/Cubix.cpp )
file(GLOB sources ${SourceDir}/*.cpp)
list(REMOVE_ITEM sources ${PROG_NAME_SRCS})
file(GLOB headers ${SourceDir}/*.h)
list(REMOVE_ITEM headers ${SourceDir}/LinkDef.h)
file(GLOB icons ${CMAKE_CURRENT_SOURCE_DIR}/icons/*)
file(GLOB database ${CMAKE_CURRENT_SOURCE_DIR}/DataBase)
file(GLOB sources ${SourceDir}/*.cpp)
include_directories(${SourceDir})
#######################
### Root dictionary ###
#######################
set(CMAKE_INSTALL_MESSAGE LAZY)
ROOT_GENERATE_DICTIONARY(G__${Lib_NAME} ${headers} LINKDEF ${SourceDir}/LinkDef.h )
ROOT_GENERATE_DICTIONARY(G__${PROG_NAME} ${headers} LINKDEF ${SourceDir}/LinkDef.h )
#####################
### Cubix Library ###
#####################
#
ADD_EXECUTABLE(${PROG_NAME} G__${PROG_NAME}.cxx ${sources} )
TARGET_LINK_LIBRARIES(${PROG_NAME} ${EXTRA_EXTERNAL_LIBRARIES} ${EXTRA_INTERNAL_LIBRARIES})
#---Create a shared library with geneated dictionary
add_library(${Lib_NAME} SHARED ${sources} G__${Lib_NAME}.cxx)
target_link_libraries(${Lib_NAME} ${EXTRA_EXTERNAL_LIBRARIES} ${EXTRA_INTERNAL_LIBRARIES})
#####################
### Cubix Program ###
#####################
#---Create a main program using the library
add_executable(${PROG_NAME} ${PROG_NAME_SRCS})
target_link_libraries(${PROG_NAME} ${Lib_NAME})
####################
### Instal Files ###
####################
install(TARGETS ${PROG_NAME} RUNTIME DESTINATION bin)
install(TARGETS ${PROG_NAME} ${Lib_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries)
install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${PROG_NAME}_rdict.pcm DESTINATION lib)
install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${PROG_NAME}.rootmap DESTINATION lib)
install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${Lib_NAME}_rdict.pcm DESTINATION lib)
install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${Lib_NAME}.rootmap DESTINATION lib)
install(FILES ${headers} DESTINATION include COMPONENT headers)
install(FILES ${icons} DESTINATION icons COMPONENT icons)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment