From 1265d13f29259be05535241e9bcbfcf16857dc06 Mon Sep 17 00:00:00 2001
From: Manuel Massing <Manuel Massing m.massing@warped-space.de>
Date: Tue, 22 Nov 2016 12:04:10 +0100
Subject: [PATCH 2/3] CMake: fix error by only setting properties for targets
 which are actually defined

---
 src/CMakeLists.txt | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8d7e7d1..59ad00a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,25 +22,30 @@ if(NOT MSVC)
   endif ()
 endif ()
 
+
 if(BUILD_CS2CS)
- include(bin_cs2cs.cmake)
+  list(APPEND BINARY_TARGETS cs2cs)
+  include(bin_cs2cs.cmake)
 endif(BUILD_CS2CS)
 
 if(BUILD_PROJ)
+  list(APPEND BINARY_TARGETS proj)
   include(bin_proj.cmake)
 endif(BUILD_PROJ)
 
 if(BUILD_GEOD)
+  list(APPEND BINARY_TARGETS geod)
   include(bin_geod.cmake)
   include(bin_geodtest.cmake)
 endif(BUILD_GEOD)
 
 if(BUILD_NAD2BIN)
+  list(APPEND BINARY_TARGETS nad2bin)
   include(bin_nad2bin.cmake)
 endif(BUILD_NAD2BIN)
 
-if (MSVC OR CMAKE_CONFIGURATION_TYPES)
+if ((MSVC OR CMAKE_CONFIGURATION_TYPES) AND BINARY_TARGETS)
   # Add _d suffix for your debug versions of the tools
-  set_target_properties (cs2cs binproj geod nad2bin PROPERTIES
-    DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
+  set_target_properties(${BINARY_TARGETS} PROPERTIES
+  DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
 endif ()
-- 
2.9.2.windows.1

