Skip to content
Snippets Groups Projects
Commit 3f541a18 authored by Pere Mato Vila's avatar Pere Mato Vila
Browse files

Changes by K. Smith (ksmith37@nd.edu) to properly handle include files in...

Changes by K. Smith (ksmith37@nd.edu) to properly handle include files in ROOT_GENERATE_DICTIONARY() macro
See https://root.cern.ch/phpBB3/viewtopic.php?f=3&t=17589
parent 34e617f7
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
# ROOT_INCLUDE_DIR PATH to the include directory # ROOT_INCLUDE_DIR PATH to the include directory
# ROOT_LIBRARIES Most common libraries # ROOT_LIBRARIES Most common libraries
# ROOT_LIBRARY_DIR PATH to the library directory # ROOT_LIBRARY_DIR PATH to the library directory
#
# Updated by K. Smith (ksmith37@nd.edu) to properly handle
# dependncies in ROOT_GENERATE_DICTIONARY
find_program(ROOT_CONFIG_EXECUTABLE root-config find_program(ROOT_CONFIG_EXECUTABLE root-config
PATHS $ENV{ROOTSYS}/bin) PATHS $ENV{ROOTSYS}/bin)
...@@ -38,17 +40,15 @@ else() ...@@ -38,17 +40,15 @@ else()
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof) #set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof)
#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics) #set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics)
set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib) set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
# Make variables changeble to the advanced user
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
if(NOT ROOT_FIND_QUIETLY)
message(STATUS "Found ROOT ${ROOT_VERSION} in ${ROOTSYS}")
endif()
endif() endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ROOT DEFAULT_MSG ROOT_CONFIG_EXECUTABLE
ROOTSYS ROOT_VERSION ROOT_INCLUDE_DIR ROOT_LIBRARIES ROOT_LIBRARY_DIR)
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
include(CMakeMacroParseArguments) include(CMakeParseArguments)
find_program(ROOTCINT_EXECUTABLE rootcint PATHS $ENV{ROOTSYS}/bin) find_program(ROOTCINT_EXECUTABLE rootcint PATHS $ENV{ROOTSYS}/bin)
find_program(GENREFLEX_EXECUTABLE genreflex PATHS $ENV{ROOTSYS}/bin) find_program(GENREFLEX_EXECUTABLE genreflex PATHS $ENV{ROOTSYS}/bin)
find_package(GCCXML) find_package(GCCXML)
...@@ -60,6 +60,12 @@ find_package(GCCXML) ...@@ -60,6 +60,12 @@ find_package(GCCXML)
# OPTIONS opt1...) # OPTIONS opt1...)
function(ROOT_GENERATE_DICTIONARY dictionary) function(ROOT_GENERATE_DICTIONARY dictionary)
CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN}) CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN})
#---Get the list of include directories------------------
get_directory_property(incdirs INCLUDE_DIRECTORIES)
set(includedirs)
foreach( d ${incdirs})
set(includedirs ${includedirs} -I${d})
endforeach()
#---Get the list of header files------------------------- #---Get the list of header files-------------------------
set(headerfiles) set(headerfiles)
foreach(fp ${ARG_UNPARSED_ARGUMENTS}) foreach(fp ${ARG_UNPARSED_ARGUMENTS})
...@@ -67,37 +73,29 @@ function(ROOT_GENERATE_DICTIONARY dictionary) ...@@ -67,37 +73,29 @@ function(ROOT_GENERATE_DICTIONARY dictionary)
if(files) if(files)
foreach(f ${files}) foreach(f ${files})
if(NOT f MATCHES LinkDef) if(NOT f MATCHES LinkDef)
set(headerfiles ${headerfiles} ${f}) find_file(headerFile ${f} PATHS ${incdirs})
set(headerfiles ${headerfiles} ${headerFile})
unset(headerFile CACHE)
endif() endif()
endforeach() endforeach()
else() else()
set(headerfiles ${headerfiles} ${fp}) find_file(headerFile ${fp} PATHS ${incdirs})
set(headerfiles ${headerfiles} ${headerFile})
unset(headerFile CACHE)
endif() endif()
endforeach() endforeach()
#---Get the list of include directories------------------
get_directory_property(incdirs INCLUDE_DIRECTORIES)
set(includedirs)
foreach( d ${incdirs})
set(includedirs ${includedirs} -I${d})
endforeach()
#---Get LinkDef.h file------------------------------------ #---Get LinkDef.h file------------------------------------
set(linkdefs) set(linkdefs)
foreach( f ${ARG_LINKDEF}) foreach( f ${ARG_LINKDEF})
if( IS_ABSOLUTE ${f}) find_file(linkFile ${f} PATHS ${incdirs})
set(linkdefs ${linkdefs} ${f}) set(linkdefs ${linkdefs} ${linkFile})
else() unset(linkFile CACHE)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
else()
set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/${f})
endif()
endif()
endforeach() endforeach()
#---call rootcint------------------------------------------ #---call rootcint------------------------------------------
add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
COMMAND ${ROOTCINT_EXECUTABLE} -cint -f ${dictionary}.cxx COMMAND ${ROOTCINT_EXECUTABLE} -cint -f ${dictionary}.cxx
-c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs} -c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs}
DEPENDS ${headerfiles} ${linkdefs}) DEPENDS ${headerfiles} ${linkdefs} VERBATIM)
endfunction() endfunction()
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment