1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-01-06 11:28:55 +01:00

add missing dependency on private headers

This commit is contained in:
q-posev 2021-11-17 10:57:03 +01:00
parent a1e6fcbfc5
commit 3dbe2f66dd

View File

@ -45,12 +45,17 @@ endif()
# ========= DEFINE TREXIO C LIBRARY ========= # ========= DEFINE TREXIO C LIBRARY =========
# Set a list of TREXIO source files that are always compiled. # Set a list of TREXIO source and header files that are always compiled.
set(TREXIO_SOURCES set(TREXIO_SOURCES
${CMAKE_SOURCE_DIR}/src/trexio.c ${CMAKE_SOURCE_DIR}/src/trexio.c
${CMAKE_SOURCE_DIR}/src/trexio_text.c ${CMAKE_SOURCE_DIR}/src/trexio_text.c
) )
set(TREXIO_HEADER ${CMAKE_SOURCE_DIR}/include/trexio.h) set(TREXIO_PUBLIC_HEADERS ${CMAKE_SOURCE_DIR}/include/trexio.h)
set(TREXIO_PRIVATE_HEADERS
${CMAKE_SOURCE_DIR}/src/trexio_s.h
${CMAKE_SOURCE_DIR}/src/trexio_private.h
${CMAKE_SOURCE_DIR}/src/trexio_text.h
)
# Conditional SHARED/STATIC build for TREXIO library. # Conditional SHARED/STATIC build for TREXIO library.
if(BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) if(BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
@ -70,11 +75,10 @@ endif()
# Set TREXIO version and include files. # Set TREXIO version and include files.
set_target_properties(trexio PROPERTIES set_target_properties(trexio PROPERTIES
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
PUBLIC_HEADER ${TREXIO_HEADER} PUBLIC_HEADER ${TREXIO_PUBLIC_HEADERS}
) )
# Set directories to be included at build time. # Set directories to be included at build time.
target_include_directories(trexio PRIVATE src)
include_directories(include) include_directories(include)
# ============= CONFIGURE HDF5 ============== # ============= CONFIGURE HDF5 ==============
@ -99,8 +103,8 @@ if(ENABLE_HDF5)
# If HDF5 found: # If HDF5 found:
# - append the trexio_hdf5.c source file with the HDF5 back end to the list TREXIO_SOURCES # - append the trexio_hdf5.c source file with the HDF5 back end to the list TREXIO_SOURCES
set(TREXIO_HDF5_SOURCE ${CMAKE_SOURCE_DIR}/src/trexio_hdf5.c) list(APPEND TREXIO_SOURCES ${CMAKE_SOURCE_DIR}/src/trexio_hdf5.c)
list(APPEND TREXIO_SOURCES ${TREXIO_HDF5_SOURCE}) list(APPEND TREXIO_PRIVATE_HEADERS ${CMAKE_SOURCE_DIR}/src/trexio_hdf5.h)
# - define symbol HAVE_HDF5=1 (used to activate HDF5 back end in the preprocessor conditionals) # - define symbol HAVE_HDF5=1 (used to activate HDF5 back end in the preprocessor conditionals)
target_compile_definitions(trexio PUBLIC "HAVE_HDF5") target_compile_definitions(trexio PUBLIC "HAVE_HDF5")
# - include directories with HDF5 header files # - include directories with HDF5 header files
@ -111,7 +115,9 @@ if(ENABLE_HDF5)
${HDF5_C_LIBRARIES}) ${HDF5_C_LIBRARIES})
endif() endif()
target_sources(trexio PRIVATE ${TREXIO_SOURCES}) # Private headers have to be listed as sources, otherwise they are installed
# with public headers upon make install (when using PRIVATE_HEADER property).
target_sources(trexio PRIVATE ${TREXIO_SOURCES} ${TREXIO_PRIVATE_HEADERS})
# ================= TESTING ================= # ================= TESTING =================
@ -186,7 +192,8 @@ if(TREXIO_DEVEL)
endif() endif()
add_custom_command(OUTPUT ${TREXIO_SOURCES} add_custom_command(OUTPUT ${TREXIO_SOURCES}
${TREXIO_HEADER} ${TREXIO_PUBLIC_HEADERS}
${TREXIO_PRIVATE_HEADERS}
${TREXIO_MOD_FILE} ${TREXIO_MOD_FILE}
COMMAND ./build_trexio.sh COMMAND ./build_trexio.sh
DEPENDS ${ORG_FILES} DEPENDS ${ORG_FILES}