comparison Resources/CMake/UuidConfiguration.cmake @ 2524:a29ffb73f6fd

optimization in cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Apr 2018 17:33:26 +0200
parents 47029de27a74
children c226799724bf
comparison
equal deleted inserted replaced
2523:21e2ed283cd5 2524:a29ffb73f6fd
37 check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H) 37 check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
38 check_include_file("sys/time.h" HAVE_SYS_TIME_H) 38 check_include_file("sys/time.h" HAVE_SYS_TIME_H)
39 check_include_file("sys/un.h" HAVE_SYS_UN_H) 39 check_include_file("sys/un.h" HAVE_SYS_UN_H)
40 check_include_file("unistd.h" HAVE_UNISTD_H) 40 check_include_file("unistd.h" HAVE_UNISTD_H)
41 41
42 If (NOT HAVE_NET_IF_H) # This is the case of OpenBSD 42 if (NOT HAVE_NET_IF_H) # This is the case of OpenBSD
43 unset(HAVE_NET_IF_H CACHE) 43 unset(HAVE_NET_IF_H CACHE)
44 check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H) 44 check_include_files("sys/socket.h;net/if.h" HAVE_NET_IF_H)
45 endif() 45 endif()
46 46
47 if (NOT HAVE_NETINET_TCP_H) # This is the case of OpenBSD 47 if (NOT HAVE_NETINET_TCP_H) # This is the case of OpenBSD
48 unset(HAVE_NETINET_TCP_H CACHE) 48 unset(HAVE_NETINET_TCP_H CACHE)
49 check_include_files("sys/socket.h;netinet/tcp.h" HAVE_NETINET_TCP_H) 49 check_include_files("sys/socket.h;netinet/tcp.h" HAVE_NETINET_TCP_H)
50 endif() 50 endif()
51 51
52 file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake " 52 if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h)
53 file(WRITE ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake "
53 #cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@ 54 #cmakedefine HAVE_NET_IF_H \@HAVE_NET_IF_H\@
54 #cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@ 55 #cmakedefine HAVE_NET_IF_DL_H \@HAVE_NET_IF_DL_H\@
55 #cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@ 56 #cmakedefine HAVE_NETINET_IN_H \@HAVE_NETINET_IN_H\@
56 #cmakedefine HAVE_STDLIB_H \@HAVE_STDLIB_H \@ 57 #cmakedefine HAVE_STDLIB_H \@HAVE_STDLIB_H \@
57 #cmakedefine HAVE_SYS_FILE_H \@HAVE_SYS_FILE_H\@ 58 #cmakedefine HAVE_SYS_FILE_H \@HAVE_SYS_FILE_H\@
62 #cmakedefine HAVE_SYS_SYSCALL_H \@HAVE_SYS_SYSCALL_H\@ 63 #cmakedefine HAVE_SYS_SYSCALL_H \@HAVE_SYS_SYSCALL_H\@
63 #cmakedefine HAVE_SYS_TIME_H \@HAVE_SYS_TIME_H\@ 64 #cmakedefine HAVE_SYS_TIME_H \@HAVE_SYS_TIME_H\@
64 #cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@ 65 #cmakedefine HAVE_SYS_UN_H \@HAVE_SYS_UN_H\@
65 #cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@ 66 #cmakedefine HAVE_UNISTD_H \@HAVE_UNISTD_H\@
66 ") 67 ")
67 68 endif()
69
68 configure_file( 70 configure_file(
69 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake 71 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h.cmake
70 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h 72 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/config.h
71 ) 73 )
72 74
73
74 configure_file( 75 configure_file(
75 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in 76 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h.in
76 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h 77 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid.h
77 ) 78 )
78 79
79 file(WRITE 80 if (NOT EXISTS ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h)
80 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h 81 file(WRITE
81 "#include <stdint.h>\n") 82 ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
82 83 "#include <stdint.h>\n")
83 #configure_file( 84 endif()
84 # ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h.in
85 # ${E2FSPROGS_SOURCES_DIR}/lib/uuid/uuid_types.h
86 # )
87 85
88 source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*) 86 source_group(ThirdParty\\uuid REGULAR_EXPRESSION ${E2FSPROGS_SOURCES_DIR}/.*)
89 87
90 else() 88 else()
91 CHECK_INCLUDE_FILE(uuid/uuid.h HAVE_UUID_H) 89 CHECK_INCLUDE_FILE(uuid/uuid.h HAVE_UUID_H)