CMakeLists.txt 2.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# CMake for module of AGAPRO
# O. Stezowski
cmake_minimum_required (VERSION 2.6)
#
project (TreeBuilder)
#
MESSAGE("[AGAPRO]  + ${PROJECT_NAME}")
#
# internal and external dependencies
#
set( EXTRA_INTERNAL_LIBRARIES AgaProCommon )
set( EXTRA_EXTERNAL_LIBRARIES ${ADF_LIBRARY} )

if (ROOT_FOUND)
    set(EXTRA_EXTERNAL_LIBRARIES ${EXTRA_EXTERNAL_LIBRARIES} Core Graf MathCore Gpad Hist Tree RIO Thread Net TreePlayer Geom)
endif()

#if (MFM_FOUND)
#    SET(EXTRA_EXTERNAL_LIBRARIES ${EXTRA_EXTERNAL_LIBRARIES} MFM)
#endif()

# headers / sources
file(GLOB headers ${PROJECT_SOURCE_DIR}/*.h)
file(GLOB sources ${PROJECT_SOURCE_DIR}/*.cpp)
Jérémie Dudouet's avatar
Jérémie Dudouet committed
25 26 27 28 29 30

if ( NOT MFM_FOUND)
     list(REMOVE_ITEM sources ${PROJECT_SOURCE_DIR}/AGAPRO_TB_AgNedDiam.cpp)
     list(REMOVE_ITEM headers ${PROJECT_SOURCE_DIR}/AGAPRO_TB_AgNedDiam.h)
endif()

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
# Remove if any
if ( NOT DO_NARVAL_INTERFACE )
    list(REMOVE_ITEM sources ${PROJECT_SOURCE_DIR}/libAGAPRO_TreeBuilder.cpp)
endif()

# add to includes
#
include_directories(${AGAPRO_INCLUDE_DIRS})

#----------------------------------------------------------------------------
#
add_library(AGAPRO_TreeBuilder SHARED ${sources})
#
target_link_libraries(AGAPRO_TreeBuilder ${EXTRA_EXTERNAL_LIBRARIES} ${EXTRA_INTERNAL_LIBRARIES})
#		
set_target_properties(AGAPRO_TreeBuilder PROPERTIES ${AGAPRO_LIBRARY_PROPERTIES})
#
install(TARGETS AGAPRO_TreeBuilder RUNTIME DESTINATION bin
                               LIBRARY DESTINATION lib
                               ARCHIVE DESTINATION lib
                               COMPONENT libraries)
install(FILES ${headers} DESTINATION include COMPONENT headers )	
										 
# copy headers file in a single directory			 	
# because cmake2.6 does not provide COPY in file, do it another way
if( ${CMAKE_VERSION} VERSION_GREATER "2.8.0" )
  file(COPY ${headers} DESTINATION ${CMAKE_BINARY_DIR}/include)	
else()
  if ( EXISTS ${CMAKE_BINARY_DIR}/include )
  else()
    execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/ )
  endif()
  foreach ( f ${headers} )
    execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${f} ${CMAKE_BINARY_DIR}/include/ )
  endforeach()
endif()