Skip to content

Commit 2b67243

Browse files
authored
Clean up SIO and Arrow configuration export (#990)
1 parent 6bfad37 commit 2b67243

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

cmake/podioConfig.cmake.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ else()
3131
find_dependency(Python3 COMPONENTS Interpreter Development)
3232
endif()
3333

34-
SET(ENABLE_SIO @ENABLE_SIO@)
35-
if(ENABLE_SIO)
34+
SET(PODIO_ENABLE_SIO @ENABLE_SIO@)
35+
if(PODIO_ENABLE_SIO)
3636
find_dependency(SIO)
3737
# Targets from SIO only become available with v00-01 so we rig them here to be
3838
# able to use them
@@ -46,8 +46,8 @@ if(ENABLE_SIO)
4646
endif()
4747
endif()
4848

49-
SET(podio_ENABLE_ARROW @ENABLE_ARROW@)
50-
if(podio_ENABLE_ARROW)
49+
SET(PODIO_ENABLE_ARROW @ENABLE_ARROW@)
50+
if(PODIO_ENABLE_ARROW)
5151
find_dependency(Arrow)
5252
endif()
5353

cmake/podioMacros.cmake

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ endfunction()
307307
# OUTPUT_FOLDER OPTIONAL: The folder in which the output files have been placed by PODIO_GENERATE_DATAMODEL. Defaults to ${CMAKE_CURRENT_SOURCE_DIR}
308308
#---------------------------------------------------------------------------------------------------
309309
function(PODIO_ADD_SIO_IO_BLOCKS CORE_LIB HEADERS SOURCES)
310+
if((DEFINED PODIO_ENABLE_SIO AND NOT PODIO_ENABLE_SIO) OR (NOT DEFINED PODIO_ENABLE_SIO AND NOT ENABLE_SIO))
311+
message(STATUS "Not adding the SIO Blocks library to the targets because SIO support is not enabled")
312+
return()
313+
endif()
314+
310315
CMAKE_PARSE_ARGUMENTS(ARG "" "OUTPUT_FOLDER" "" ${ARGN})
311316
IF(NOT ARG_OUTPUT_FOLDER)
312317
SET(ARG_OUTPUT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
@@ -316,11 +321,6 @@ function(PODIO_ADD_SIO_IO_BLOCKS CORE_LIB HEADERS SOURCES)
316321
LIST(FILTER HEADERS INCLUDE REGEX .*SIOBlock.h)
317322
LIST(FILTER SOURCES INCLUDE REGEX .*SIOBlock.cc)
318323

319-
IF(NOT HEADERS)
320-
MESSAGE(STATUS "Not adding the SIO Blocks library to the targets because the corresponding c++ sources have not been generated")
321-
RETURN()
322-
ENDIF()
323-
324324
add_library(${CORE_LIB}SioBlocks SHARED ${SOURCES} ${HEADERS})
325325
target_link_libraries(${CORE_LIB}SioBlocks PUBLIC ${CORE_LIB} podio::podio podio::podioSioIO SIO::sio)
326326
target_include_directories(${CORE_LIB}SioBlocks PUBLIC
@@ -348,9 +348,10 @@ endfunction()
348348
# OUTPUT_FOLDER OPTIONAL: The folder in which the output files have been placed by PODIO_GENERATE_DATAMODEL. Defaults to ${CMAKE_CURRENT_SOURCE_DIR}
349349
#---------------------------------------------------------------------------------------------------
350350
function(PODIO_ADD_ARROW CORE_LIB HEADERS SOURCES)
351-
if(NOT ENABLE_ARROW)
352-
return()
353-
endif()
351+
if((DEFINED PODIO_ENABLE_ARROW AND NOT PODIO_ENABLE_ARROW) OR (NOT DEFINED PODIO_ENABLE_ARROW AND NOT ENABLE_ARROW))
352+
message(STATUS "Not adding the Arrow library to the targets because Arrow support is not enabled")
353+
return()
354+
endif()
354355

355356
cmake_parse_arguments(ARG "" "OUTPUT_FOLDER" "" ${ARGN})
356357
if(NOT ARG_OUTPUT_FOLDER)
@@ -360,11 +361,6 @@ function(PODIO_ADD_ARROW CORE_LIB HEADERS SOURCES)
360361
# Only get the ArrowMapper handlers
361362
list(FILTER SOURCES INCLUDE REGEX .*ArrowMapper.cc)
362363

363-
if(NOT SOURCES)
364-
message(STATUS "Not adding the Arrow library to the targets because the corresponding c++ sources have not been generated")
365-
return()
366-
endif()
367-
368364
add_library(${CORE_LIB}Arrow SHARED ${SOURCES})
369365
target_link_libraries(${CORE_LIB}Arrow PUBLIC ${CORE_LIB} podio::podio ${PODIO_ARROW_TARGET})
370366
target_include_directories(${CORE_LIB}Arrow PUBLIC

0 commit comments

Comments
 (0)