summaryrefslogtreecommitdiffstats
path: root/examples/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-05-22 15:23:16 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-05-22 15:23:16 (GMT)
commite96ef71034fbeadcf2ed244b15a14b7151529d29 (patch)
tree0b07ebf5d12fc46ebfb5ae353a3d0ebad5033a85 /examples/CMakeLists.txt
parente1e63edd359e3753c374440bdb295010c348e9bc (diff)
downloadhdf5-e96ef71034fbeadcf2ed244b15a14b7151529d29.zip
hdf5-e96ef71034fbeadcf2ed244b15a14b7151529d29.tar.gz
hdf5-e96ef71034fbeadcf2ed244b15a14b7151529d29.tar.bz2
HDFFV-9739 and cmake improvements merge from develop
Diffstat (limited to 'examples/CMakeLists.txt')
-rw-r--r--examples/CMakeLists.txt27
1 files changed, 13 insertions, 14 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 4da8405..2239d64 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,10 +1,5 @@
cmake_minimum_required (VERSION 3.10)
-PROJECT (HDF5_EXAMPLES)
-
-#-----------------------------------------------------------------------------
-# Apply Definitions to compiler in this directory and below
-#-----------------------------------------------------------------------------
-add_definitions (${HDF_EXTRA_C_FLAGS})
+project (HDF5_EXAMPLES C)
#-----------------------------------------------------------------------------
# Define Sources
@@ -46,26 +41,30 @@ set (examples
foreach (example ${examples})
add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c)
- TARGET_C_PROPERTIES (${example} STATIC " " " ")
- target_link_libraries (${example} ${HDF5_LIB_TARGET})
+ target_include_directories(${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${example} STATIC)
+ target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET})
set_target_properties (${example} PROPERTIES FOLDER examples)
if (BUILD_SHARED_LIBS)
add_executable (${example}-shared ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c)
- TARGET_C_PROPERTIES (${example}-shared SHARED " " " ")
- target_link_libraries (${example}-shared ${HDF5_LIBSH_TARGET})
+ target_include_directories(${example}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${example}-shared SHARED)
+ target_link_libraries (${example}-shared PRIVATE ${HDF5_LIBSH_TARGET})
set_target_properties (${example}-shared PROPERTIES FOLDER examples)
endif ()
endforeach ()
if (H5_HAVE_PARALLEL)
add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c)
- TARGET_C_PROPERTIES (ph5example STATIC " " " ")
- target_link_libraries (ph5example ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES})
+ target_include_directories(ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (ph5example STATIC)
+ target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES})
set_target_properties (ph5example PROPERTIES FOLDER examples)
if (BUILD_SHARED_LIBS)
add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c)
- TARGET_C_PROPERTIES (ph5example-shared SHARED " " " ")
- target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
+ target_include_directories(ph5example-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (ph5example-shared SHARED)
+ target_link_libraries (ph5example-shared PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES})
set_target_properties (ph5example-shared PROPERTIES FOLDER examples)
endif ()
endif ()