From 145f6dc327a1c44524c621f6680de5807e0c3237 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Fri, 4 Jun 2004 14:59:05 -0400
Subject: [PATCH] ERR: Do not add the library if no sources are used.

---
 CMakeLists.txt | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 405a1409..6a158316 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -329,12 +329,14 @@ ENDFOREACH(h)
 
 #-----------------------------------------------------------------------------
 # Add the library with the configured name and list of sources.
-ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE} ${KWSYS_SRCS})
-
-# Create an install target for the library.
-IF(KWSYS_LIBRARY_INSTALL_DIR)
-  INSTALL_TARGETS(${KWSYS_LIBRARY_INSTALL_DIR} ${KWSYS_NAMESPACE})
-ENDIF(KWSYS_LIBRARY_INSTALL_DIR)
+IF(KWSYS_SRCS)
+  ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE} ${KWSYS_SRCS})
+
+  # Create an install target for the library.
+  IF(KWSYS_LIBRARY_INSTALL_DIR)
+    INSTALL_TARGETS(${KWSYS_LIBRARY_INSTALL_DIR} ${KWSYS_NAMESPACE})
+  ENDIF(KWSYS_LIBRARY_INSTALL_DIR)
+ENDIF(KWSYS_SRCS)
 
 # For building kwsys itself, we use a macro defined on the command
 # line to configure the namespace in the C and C++ source files.
-- 
GitLab