summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
commit2347bffaa2d48b62a22575fbc93b1f5c2716d8d4 (patch)
tree963395e7cd4bd66761194c8cee840906b16abb3a /examples
parentbc9a773b994cde788e97e5e998eb5fcd21ec8a39 (diff)
downloadhdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.zip
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.gz
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.bz2
TRILABS-19 remove add_defintions and use generator expressions
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt29
1 files changed, 12 insertions, 17 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 05646d8..48f85f6 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10)
project (HDF5_EXAMPLES C)
#-----------------------------------------------------------------------------
-# Apply Definitions to compiler in this directory and below
-#-----------------------------------------------------------------------------
-add_definitions (${HDF_EXTRA_C_FLAGS})
-
-#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
set (examples
@@ -46,30 +41,30 @@ set (examples
foreach (example ${examples})
add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c)
- set_property(TARGET ${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
- TARGET_C_PROPERTIES (${example} STATIC " " " ")
- target_link_libraries (${example} ${HDF5_LIB_TARGET})
+ target_include_directories(${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
+ 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)
- set_property(TARGET ${example}-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
- 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}")
+ 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)
- set_property(TARGET ph5example APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
- 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}")
+ 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)
- set_property(TARGET ph5example-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
- 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}")
+ 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 ()