changeset 2524:a29ffb73f6fd

optimization in cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Apr 2018 17:33:26 +0200
parents 21e2ed283cd5
children 94423976888e
files Resources/CMake/LibIconvConfiguration.cmake Resources/CMake/UuidConfiguration.cmake
diffstat 2 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/LibIconvConfiguration.cmake	Tue Apr 10 16:48:49 2018 +0200
+++ b/Resources/CMake/LibIconvConfiguration.cmake	Tue Apr 10 17:33:26 2018 +0200
@@ -50,8 +50,10 @@
     unset(EILSEQ)
     unset(HAVE_WCHAR_T)
 
-    # Create an empty "config.h" for libiconv
-    file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "")
+    if (NOT EXISTS ${LIBICONV_SOURCES_DIR}/include/config.h)
+      # Create an empty "config.h" for libiconv
+      file(WRITE ${LIBICONV_SOURCES_DIR}/include/config.h "")
+    endif()
 
     include_directories(
       ${LIBICONV_SOURCES_DIR}/include
--- a/Resources/CMake/UuidConfiguration.cmake	Tue Apr 10 16:48:49 2018 +0200
+++ b/Resources/CMake/UuidConfiguration.cmake	Tue Apr 10 17:33:26 2018 +0200
@@ -39,7 +39,7 @@
     check_include_file("sys/un.h"       HAVE_SYS_UN_H)
     check_include_file("unistd.h"       HAVE_UNISTD_H)
 
-    If (NOT HAVE_NET_IF_H)  # This is the case of OpenBSD
+    if (NOT HAVE_NET_IF_H)  # This is the case of OpenBSD
       unset(HAVE_NET_IF_H CACHE)
       check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H)
     endif()
@@ -49,7 +49,8 @@
       check_include_files("sys/socket.h;netinet/tcp.h" HAVE_NETINET_TCP_H)
     endif()
 
-    file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake "
+    if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h)
+      file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake "
 #cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@
 #cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@
 #cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@
@@ -64,26 +65,23 @@
 #cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@
 #cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@
 ")
-    
+    endif()
+      
     configure_file(
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h
       )
-    
-    
+      
     configure_file(
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in
       ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h
       )
 
-    file(WRITE
-      ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
-      "#include <stdint.h>\n")
-
-    #configure_file(
-    #  ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h.in
-    #  ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
-    #  )
+    if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h)
+      file(WRITE
+        ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
+        "#include <stdint.h>\n")
+    endif()
     
     source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*)