Browse code

* fix mingw, update sde

Nat! authored on 28-07-2018 13:37:36
Showing 28 changed files
... ...
@@ -11,7 +11,10 @@ export MULLE_MATCH_FIND_LOCATIONS="${PROJECT_SOURCE_DIR}:CMakeLists.txt:cmake"
11 11
 #
12 12
 #
13 13
 #
14
-export MULLE_SDE_INSTALLED_VERSION="0.24.3"
14
+export MULLE_SDE_INSTALLED_VERSION="0.28.4"
15
+
16
+# By default assume a project has source and a sourcetree in that order.
17
+
15 18
 
16 19
 # By default assume a project has source and a sourcetree in that order.
17 20
 
... ...
@@ -4,7 +4,15 @@
4 4
    echo "Your script needs to setup MULLE_VIRTUAL_ROOT \
5 5
 and MULLE_UNAME properly" >&2  && exit 1
6 6
 
7
-MULLE_HOSTNAME="`PATH=/bin:/usr/bin hostname -s`" # don't export it
7
+case "${MULLE_UNAME}" in
8
+   'mingw'*)
9
+      MULLE_HOSTNAME="`PATH=/bin:/usr/bin hostname`" # don't export it
10
+   ;;
11
+
12
+   *)
13
+      MULLE_HOSTNAME="`PATH=/bin:/usr/bin hostname -s`" # don't export it
14
+   ;;
15
+esac
8 16
 
9 17
 MULLE_ENV_SHARE_DIR="${MULLE_VIRTUAL_ROOT}/.mulle-env/share"
10 18
 MULLE_ENV_ETC_DIR="${MULLE_VIRTUAL_ROOT}/.mulle-env/etc"
... ...
@@ -1,7 +1,12 @@
1 1
 
2 2
 inotifywait
3 3
 ssh
4
+curl
5
+wget
6
+uuidgen
4 7
 cc
8
+clang
5 9
 gcc
6 10
 ld
7 11
 ninja
12
+make
... ...
@@ -62,9 +62,6 @@ tr
62 62
 vi
63 63
 wc
64 64
 which
65
-curl
66 65
 column
67 66
 git
68
-uuidgen
69 67
 cmake
70
-make
... ...
@@ -1 +1 @@
1
-0.15.4
1
+0.16.1
... ...
@@ -53,14 +53,18 @@ uname_to_cpp()
53 53
    local uname="$1"  # the part after only-os or no
54 54
 
55 55
    case "${uname}" in
56
-      "darwin")
56
+      'darwin')
57 57
          echo "__APPLE__"
58 58
       ;;
59 59
 
60
-      "freebsd")
60
+      'freebsd')
61 61
          echo "BSD4_3"  # guess
62 62
       ;;
63 63
 
64
+      'mingw'*)
65
+         echo "_WIN32"
66
+      ;;
67
+
64 68
       *)
65 69
          echo "__${uname}__"
66 70
       ;;
... ...
@@ -119,7 +123,6 @@ _emit_c_include()
119 123
    local address="$1"
120 124
    local header="$2"
121 125
    local marks="$3"
122
-   local aliases="$4"
123 126
 
124 127
    local indent
125 128
    local ifstatement
... ...
@@ -183,8 +186,7 @@ emit_c_include_library()
183 186
 
184 187
    local address="$1"
185 188
    local marks="$2"
186
-   local aliases="$3"
187
-   local header="$4"
189
+   local header="$3"
188 190
 
189 191
    #
190 192
    # the default for libraries is old style <name.h> not <name/name.h>
... ...
@@ -197,7 +199,7 @@ emit_c_include_library()
197 199
       header="${name}.h"
198 200
    fi
199 201
 
200
-   _emit_c_include "${address}" "${header}" "${marks}" "${aliases}"
202
+   _emit_c_include "${address}" "${header}" "${marks}"
201 203
 
202 204
 }
203 205
 
... ...
@@ -208,8 +210,7 @@ emit_c_include_dependency()
208 210
 
209 211
    local address="$1"
210 212
    local marks="$2"
211
-   local aliases="$3"
212
-   local header="$4"
213
+   local header="$3"
213 214
 
214 215
    #
215 216
    # the default for dependencies is <name/name.h>
... ...
@@ -222,7 +223,7 @@ emit_c_include_dependency()
222 223
       header="${name}/${name}.h"
223 224
    fi
224 225
 
225
-   _emit_c_include "${address}" "${header}" "${marks}" "${aliases}"
226
+   _emit_c_include "${address}" "${header}" "${marks}"
226 227
 }
227 228
 
228 229
 
... ...
@@ -241,8 +242,7 @@ emit_c_header()
241 242
    local headers
242 243
 
243 244
    headers="`exekutor mulle-sourcetree list \
244
-                                       --format "%a;%m;%i={aliases,,-------};\
245
-%i={include,,-------}\\n" \
245
+                                       --format "%a;%m;%i={include,,-------}\\n" \
246 246
                                        --marks "${filter_marks}" \
247 247
                                        --output-raw \
248 248
                                        --no-output-header`" || return 1
... ...
@@ -259,7 +259,7 @@ emit_c_header()
259 259
       local marks
260 260
       local include
261 261
 
262
-      IFS=";" read address marks aliases include <<< "${header}"
262
+      IFS=";" read address marks include <<< "${header}"
263 263
 
264 264
       if [ -z "${address}" ]
265 265
       then
... ...
@@ -272,7 +272,6 @@ emit_c_header()
272 272
          *,no-dependency,*)
273 273
             emit_c_include_library "${address}" \
274 274
                                    "${marks}" \
275
-                                   "${aliases}" \
276 275
                                    "${include}" \
277 276
                                    "$@"
278 277
          ;;
... ...
@@ -280,7 +279,6 @@ emit_c_header()
280 279
          *)
281 280
             emit_c_include_dependency "${address}" \
282 281
                                       "${marks}" \
283
-                                      "${aliases}" \
284 282
                                       "${include}" \
285 283
                                       "$@"
286 284
          ;;
... ...
@@ -66,6 +66,10 @@ uname_to_cmake()
66 66
          fail "uname is empty"
67 67
       ;;
68 68
 
69
+      'mingw')
70
+         systemname="Windows"
71
+      ;;
72
+      
69 73
       *)
70 74
          systemname="`tr 'a-z' 'A-Z' <<< "${uname:0:1}"`"
71 75
          systemname="${systemname}${uname:1}"
... ...
@@ -136,7 +140,7 @@ _emit_cmake_find_library()
136 140
 
137 141
    local preference="$1"; shift
138 142
 
139
-   local aliases="$1"
143
+   local names="$1"
140 144
    local identifier="$2"
141 145
    local containername="$3"
142 146
    local marks="$4"
... ...
@@ -146,7 +150,7 @@ _emit_cmake_find_library()
146 150
    local i
147 151
 
148 152
    IFS=","; set -o noglob
149
-   for i in ${aliases}
153
+   for i in ${names}
150 154
    do
151 155
       case "${preference}" in
152 156
          "static")
... ...
@@ -167,10 +171,16 @@ _emit_cmake_find_library()
167 171
    local failstatus
168 172
 
169 173
    case ",${marks}," in
170
-      *,no-require-link,*)
174
+      *',no-require-link,'*)
175
+
176
+         failstatus="STATUS"
177
+         failstring="${identifier}_LIBRARY is missing but it is marked as \\\"no-require-link\\\""
178
+      ;;
179
+
180
+      *',no-require,'*)
171 181
 
172 182
          failstatus="STATUS"
173
-         failstring="${identifier}_LIBRARY is missing but it\'s \"no-require-link\""
183
+         failstring="${identifier}_LIBRARY is missing but it is marked as \\\"no-require\\\""
174 184
       ;;
175 185
 
176 186
       *)
... ...
@@ -200,7 +210,7 @@ ${indent}      get_filename_component( _TMP_${identifier}_ROOT "\${${identifier}
200 210
 ${indent}      get_filename_component( _TMP_${identifier}_ROOT "\${_TMP_${identifier}_ROOT}" DIRECTORY)
201 211
 ${indent}
202 212
 ${indent}      # search for DependenciesAndLibraries.cmake to include
203
-${indent}      foreach( _TMP_${identifier}_NAME in ${aliases})
213
+${indent}      foreach( _TMP_${identifier}_NAME in ${names})
204 214
 ${indent}         set( _TMP_${identifier}_DIR "\${_TMP_${identifier}_ROOT}/include/\${_TMP_${identifier}_NAME}/cmake")
205 215
 ${indent}         # use explicit path to avoid "surprises"
206 216
 ${indent}         if( EXISTS "\${_TMP_${identifier}_DIR}/DependenciesAndLibraries.cmake")
... ...
@@ -229,7 +239,7 @@ EOF
229 239
          cat <<EOF
230 240
 ${indent}
231 241
 ${indent}      # search for objc-loader.inc in include directory
232
-${indent}      foreach( _TMP_${identifier}_NAME in ${aliases})
242
+${indent}      foreach( _TMP_${identifier}_NAME in ${names})
233 243
 ${indent}         set( _TMP_${identifier}_FILE "\${_TMP_${identifier}_ROOT}/include/\${_TMP_${identifier}_NAME}/objc-loader.inc")
234 244
 ${indent}         if( EXISTS "\${_TMP_${identifier}_FILE}")
235 245
 ${indent}            set( INHERITED_OBJC_LOADERS
... ...
@@ -275,7 +285,7 @@ _emit_cmake_header_only()
275 285
 {
276 286
    log_entry "_emit_cmake_header_only" "$@"
277 287
 
278
-   local aliases="$1"
288
+   local names="$1"
279 289
    local identifier="$2"
280 290
    local containername="$3"
281 291
    local marks="$4"
... ...
@@ -285,7 +295,7 @@ _emit_cmake_header_only()
285 295
    local i
286 296
 
287 297
    IFS=","; set -o noglob
288
-   for i in ${aliases}
298
+   for i in ${names}
289 299
    do
290 300
       headers="`concat "${headers}" "${i}.h"`"
291 301
       headers="`concat "${headers}" "${i}/${i}.h"`"
... ...
@@ -293,10 +303,16 @@ _emit_cmake_header_only()
293 303
    IFS="${DEFAULT_IFS}"; set +o noglob
294 304
 
295 305
    case ",${marks}," in
296
-      *,no-require-link,*)
306
+      *',no-require-header,'*)
307
+
308
+         failstatus="STATUS"
309
+         failstring="${identifier}_HEADER is missing but it is marked as \\\"no-require-header\\\""
310
+      ;;
311
+
312
+      *',no-require,'*)
297 313
 
298 314
          failstatus="STATUS"
299
-         failstring="${identifier}_HEADER is missing but it\'s \"no-require-link\""
315
+         failstring="${identifier}_LIBRARY is missing but it is marked as \\\"no-require\\\""
300 316
       ;;
301 317
 
302 318
       *)
... ...
@@ -304,8 +320,11 @@ _emit_cmake_header_only()
304 320
          failstring="${identifier}_HEADER was not found"
305 321
       ;;
306 322
    esac
323
+
307 324
    #
308
-   # the idea here is that cmake should generate the proper -I option
325
+   # The idea here is that cmake should generate the proper -I option.
326
+   # The header find_file might be useful to copy it somewhere. Otherwise
327
+   # probably useless. (could leave it out)
309 328
    #
310 329
    cat <<EOF
311 330
 ${indent}if( NOT ${identifier}_HEADER)
... ...
@@ -388,14 +407,12 @@ emit_cmake_dependency()
388 407
 
389 408
    local identifier
390 409
    local filename
410
+   local names
391 411
 
392
-   if [ -z "${aliases}" ]
393
-   then
394
-      aliases="${address}"
395
-   fi
412
+   names="`comma_concat "${aliases}" "${address}" `"
396 413
 
397 414
    # first alias determines the identifier
398
-   filename="`fast_basename "${aliases%%,*}"`"
415
+   filename="`fast_basename "${names%%,*}"`"
399 416
 
400 417
    if [ -z "${MULLE_CASE_SH}" ]
401 418
    then
... ...
@@ -407,7 +424,7 @@ emit_cmake_dependency()
407 424
    identifier="`printf "%s" "${identifier}" | tr -c 'a-zA-Z0-9' '_'`"
408 425
    identifier="`tr 'a-z' 'A-Z' <<< "${identifier}"`"
409 426
 
410
-   "${emitter}" "${aliases}" \
427
+   "${emitter}" "${names}" \
411 428
                 "${identifier}" \
412 429
                 "${name}" \
413 430
                 "${marks}" \
... ...
@@ -1 +1 @@
1
-0.5.0
1
+0.8.4
... ...
@@ -1 +1 @@
1
-0.5.0
1
+0.8.4
... ...
@@ -1 +1 @@
1
-0.5.0
1
+0.8.4
... ...
@@ -1 +1 @@
1
-0.7.0
1
+0.9.10
... ...
@@ -1 +1 @@
1
-0.7.0
1
+0.9.10
... ...
@@ -1 +1 @@
1
-0.7.0
1
+0.9.10
... ...
@@ -1 +1 @@
1
-0.7.0
1
+0.9.10
... ...
@@ -91,7 +91,13 @@ add_library( "mulle-vararg"
91 91
 )
92 92
 
93 93
 
94
-set( INSTALL_LIBRARY_TARGETS "mulle-vararg")
94
+
95
+include( Library OPTIONAL)
96
+
97
+set( INSTALL_LIBRARY_TARGETS
98
+   "mulle-vararg"
99
+   "${INSTALL_LIBRARY_TARGETS}"
100
+)
95 101
 
96 102
 include( PostLibrary OPTIONAL)
97 103
 
... ...
@@ -1,3 +1,7 @@
1
+### 1.0.5
2
+
3
+* fix mingw, update sde
4
+
1 5
 ### 1.0.4
2 6
 
3 7
 * modernized mulle-sde
4 8
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+# can be included multiple times
2
+
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
5
+endif()
6
+
7
+include( AllLoadC)
8
+
9
+CreateForceAllLoadList( ALL_LOAD_DEPENDENCY_LIBRARIES FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES)
10
+
11
+set( EXECUTABLE_LIBRARY_LIST
12
+   ${FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES}
13
+   ${EXECUTABLE_LIBRARY_LIST}
14
+)
15
+
16
+include( ExecutableCAux OPTIONAL)
0 17
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+# can be included multiple times
2
+
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
5
+endif()
6
+
7
+include( AllLoadC)
8
+include( StartupC)
9
+include( StandaloneC)
10
+
11
+include( LibraryCAux OPTIONAL)
... ...
@@ -1,7 +1,15 @@
1
+# can be included multiple times
2
+
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
5
+endif()
6
+
1 7
 if( NOT __LINK_MANIFEST_C_CMAKE__)
2 8
    set( __LINK_MANIFEST_C_CMAKE__ ON)
3 9
 
4
-  option( LINK_MANIFEST "Enable link info output" ON)
10
+   option( LINK_MANIFEST "Enable link info output" ON)
11
+endif()
12
+
5 13
 
6 14
 #
7 15
 # Since tests do not know how to link stuff, and we don't really want to
... ...
@@ -10,61 +18,64 @@ if( NOT __LINK_MANIFEST_C_CMAKE__)
10 18
 #
11 19
 # We could also just grep CMakeCache.txt here, but how stable is its format ?
12 20
 #
13
-   if( LINK_MANIFEST)
21
+if( LINK_MANIFEST)
14 22
 
15
-      set( LINK_MANIFEST_FILES
16
-            ${PROJECT_BINARY_DIR}/os-specific-libraries.txt
17
-            ${PROJECT_BINARY_DIR}/dependency-libraries.txt
18
-            ${PROJECT_BINARY_DIR}/optional-dependency-libraries.txt
19
-            ${PROJECT_BINARY_DIR}/all-load-dependency-libraries.txt
20
-      )
23
+   if( NOT LIBRARY_NAME)
24
+      set( LIBRARY_NAME "mulle-vararg")
25
+   endif()
21 26
 
22
-      add_custom_target( __link-manifest__ ALL
23
-                     DEPENDS ${LINK_MANIFEST_FILES}
24
-      )
27
+   set( LINK_MANIFEST_FILES
28
+         ${PROJECT_BINARY_DIR}/os-specific-libraries.txt
29
+         ${PROJECT_BINARY_DIR}/dependency-libraries.txt
30
+         ${PROJECT_BINARY_DIR}/optional-dependency-libraries.txt
31
+         ${PROJECT_BINARY_DIR}/all-load-dependency-libraries.txt
32
+   )
25 33
 
26
-      add_dependencies( __link-manifest__ "mulle-vararg")
34
+   add_custom_target( __link-manifest__ ALL
35
+                  DEPENDS ${LINK_MANIFEST_FILES}
36
+   )
27 37
 
28
-     # add_dependencies( MulleObjC os_specific_libs)
38
+   add_dependencies( __link-manifest__ "${LIBRARY_NAME}")
29 39
 
30
-      add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/os-specific-libraries.txt
40
+  # add_dependencies( MulleObjC os_specific_libs)
31 41
 
32
-                         COMMAND echo "${OS_SPECIFIC_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/os-specific-libraries.txt
42
+   add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/os-specific-libraries.txt
33 43
 
34
-                         WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
35
-                         COMMENT "Create: os-specific-libraries.txt"
36
-                         VERBATIM)
44
+                      COMMAND echo "${OS_SPECIFIC_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/os-specific-libraries.txt
37 45
 
46
+                      WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
47
+                      COMMENT "Create: os-specific-libraries.txt"
48
+                      VERBATIM)
38 49
 
39
-      add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/dependency-libraries.txt
40 50
 
41
-                         COMMAND echo "${DEPENDENCY_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/dependency-libraries.txt
51
+   add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/dependency-libraries.txt
42 52
 
43
-                         WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
44
-                         COMMENT "Create: dependency-libraries.txt"
45
-                         VERBATIM)
53
+                      COMMAND echo "${DEPENDENCY_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/dependency-libraries.txt
46 54
 
47
-      add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/optional-dependency-libraries.txt
55
+                      WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
56
+                      COMMENT "Create: dependency-libraries.txt"
57
+                      VERBATIM)
48 58
 
49
-                         COMMAND echo "${OPTIONAL_DEPENDENCY_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/optional-dependency-libraries.txt
59
+   add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/optional-dependency-libraries.txt
50 60
 
51
-                         WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
52
-                         COMMENT "Create: optional-dependency-libraries.txt"
53
-                         VERBATIM)
61
+                      COMMAND echo "${OPTIONAL_DEPENDENCY_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/optional-dependency-libraries.txt
54 62
 
63
+                      WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
64
+                      COMMENT "Create: optional-dependency-libraries.txt"
65
+                      VERBATIM)
55 66
 
56
-      add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/all-load-dependency-libraries.txt
57 67
 
58
-                         COMMAND echo "${ALL_LOAD_DEPENDENCY_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/all-load-dependency-libraries.txt
68
+   add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/all-load-dependency-libraries.txt
59 69
 
60
-                         WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
61
-                         COMMENT "Create: all-load-dependency-libraries.txt"
62
-                         VERBATIM)
70
+                      COMMAND echo "${ALL_LOAD_DEPENDENCY_LIBRARIES}" | tr ";" "\\012" > ${PROJECT_BINARY_DIR}/all-load-dependency-libraries.txt
63 71
 
64
-      # definitions from cmake/share/LinkManifest.cmake
65
-      install( FILES ${LINK_MANIFEST_FILES}  DESTINATION "include/mulle-vararg/link")
72
+                      WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
73
+                      COMMENT "Create: all-load-dependency-libraries.txt"
74
+                      VERBATIM)
66 75
 
67
-   endif()
76
+   # definitions from cmake/share/LinkManifest.cmake
77
+   install( FILES ${LINK_MANIFEST_FILES}  DESTINATION "include/${LIBRARY_NAME}/link")
68 78
 
69
-   include( LinkManifestCAux OPTIONAL)
70 79
 endif()
80
+
81
+include( LinkManifestCAux OPTIONAL)
... ...
@@ -26,4 +26,6 @@ if( NOT __MOTD__CMAKE__)
26 26
       add_dependencies( __motd__ ${PROJECT_NAME})
27 27
    endif()
28 28
 
29
+   include( MotdAux OPTIONAL)
30
+
29 31
 endif()
... ...
@@ -1,19 +1,7 @@
1
-if( NOT __POST_EXECUTABLE__CMAKE__)
2
-   set( __POST_EXECUTABLE__CMAKE__ ON)
3
-
4
-   if( MULLE_TRACE_INCLUDE)
5
-      message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
6
-   endif()
7
-
8
-   include( AllLoadC)
9
-
10
-   CreateForceAllLoadList( ALL_LOAD_DEPENDENCY_LIBRARIES FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES)
11
-
12
-   set( EXECUTABLE_LIBRARY_LIST
13
-      ${FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES}
14
-      ${EXECUTABLE_LIBRARY_LIST}
15
-   )
16
-
17
-   include( PostExecutableCAux OPTIONAL)
1
+# can be included multiple times
18 2
 
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
19 5
 endif()
6
+
7
+include( PostExecutableCAux OPTIONAL)
... ...
@@ -1,16 +1,9 @@
1
-if( NOT __POST_LIBRARY__CMAKE__)
2
-   set( __POST_LIBRARY__CMAKE__ ON)
1
+# can be included multiple times
3 2
 
4
-   if( MULLE_TRACE_INCLUDE)
5
-      message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
6
-   endif()
7
-
8
-   include( AllLoadC)
9
-   include( StartupC)
10
-   include( StandaloneC)
11
-
12
-   include( LinkManifestC)
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
5
+endif()
13 6
 
14
-   include( PostLibraryCAux OPTIONAL)
7
+include( LinkManifestC)
15 8
 
16
-endif()
9
+include( PostLibraryCAux OPTIONAL)
... ...
@@ -1,20 +1,17 @@
1
-if( NOT __POST_SHARED_LIBRARY_C_CMAKE__)
2
-   set( __POST_SHARED_LIBRARY_C_CMAKE__ ON)
1
+# can be included multiple times
3 2
 
4
-   if( MULLE_TRACE_INCLUDE)
5
-      message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
6
-   endif()
7
-
8
-   # included by PostLibrary already
9
-   # include( AllLoadC)
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
5
+endif()
10 6
 
11
-   CreateForceAllLoadList( ALL_LOAD_DEPENDENCY_LIBRARIES FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES)
7
+# included by PostLibrary already
8
+# include( AllLoadC)
12 9
 
13
-   set( SHARED_LIBRARY_LIST
14
-      ${FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES}
15
-      ${SHARED_LIBRARY_LIST}
16
-   )
10
+CreateForceAllLoadList( ALL_LOAD_DEPENDENCY_LIBRARIES FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES)
17 11
 
18
-   include( SharedLibraryCAux OPTIONAL)
12
+set( SHARED_LIBRARY_LIST
13
+   ${FORCE_ALL_LOAD_DEPENDENCY_LIBRARIES}
14
+   ${SHARED_LIBRARY_LIST}
15
+)
19 16
 
20
-endif()
17
+include( SharedLibraryCAux OPTIONAL)
... ...
@@ -1,9 +1,7 @@
1
-if( NOT __PRE_EXECUTABLE__CMAKE__)
2
-   set( __PRE_EXECUTABLE__CMAKE__ ON)
1
+# can be included multiple times
3 2
 
4
-   if( MULLE_TRACE_INCLUDE)
5
-      message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
6
-   endif()
7
-
8
-   include( PreExecutableCAux OPTIONAL)
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
9 5
 endif()
6
+
7
+include( PreExecutableCAux OPTIONAL)
... ...
@@ -1,10 +1,7 @@
1
-if( NOT __PRE_LIBRARY__CMAKE__)
2
-   set( __PRE_LIBRARY__CMAKE__ ON)
3
-
4
-   if( MULLE_TRACE_INCLUDE)
5
-      message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
6
-   endif()
7
-
8
-   include( PreLibraryCAux OPTIONAL)
1
+# can be included multiple times
9 2
 
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
10 5
 endif()
6
+
7
+include( PreLibraryCAux OPTIONAL)
... ...
@@ -1,27 +1,38 @@
1
+# can be included multiple times
2
+
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
5
+endif()
6
+
1 7
 if( NOT __STANDALONE_C_CMAKE__)
2 8
    set( __STANDALONE_C_CMAKE__ ON)
3 9
 
4
-   if( MULLE_TRACE_INCLUDE)
5
-      message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
6
-   endif()
7
-
8 10
    option( STANDALONE "Create standalone library for debugging" OFF)
11
+endif()
9 12
 
10
-   # include before (!)
11 13
 
12
-   include( StandaloneCAux OPTIONAL)
14
+# include before (!)
13 15
 
14
-   if( STANDALONE)
16
+include( StandaloneCAux OPTIONAL)
15 17
 
16
-      if( NOT STANDALONE_NAME)
17
-         set( STANDALONE_NAME "mulle-vararg-standalone")
18
-      endif()
18
+if( STANDALONE)
19
+   if( NOT LIBRARY_NAME)
20
+      set( LIBRARY_NAME "mulle-vararg")
21
+   endif()
22
+
23
+   if( NOT STANDALONE_NAME)
24
+      set( STANDALONE_NAME "mulle-vararg-standalone")
25
+   endif()
26
+
27
+   if( NOT STANDALONE_DEFINITIONS)
19 28
       set( STANDALONE_DEFINITIONS ${MULLE_VARARG_DEFINITIONS})
29
+   endif()
20 30
 
21
-      #
22
-      # A standalone library has all symbols and nothing is optimized away
23
-      # sorta like a big static library, just shared
24
-      #
31
+   #
32
+   # A standalone library has all symbols and nothing is optimized away
33
+   # sorta like a big static library, just shared
34
+   #
35
+   if( NOT STANDALONE_ALL_LOAD_LIBRARIES)
25 36
       set( STANDALONE_ALL_LOAD_LIBRARIES
26 37
          $<TARGET_FILE:mulle-vararg>
27 38
          ${ALL_LOAD_DEPENDENCY_LIBRARIES}
... ...
@@ -29,129 +40,128 @@ if( NOT __STANDALONE_C_CMAKE__)
29 40
          ${OPTIONAL_DEPENDENCY_LIBRARIES}
30 41
          ${OS_SPECIFIC_LIBRARIES}
31 42
       )
43
+   endif()
32 44
 
33
-      # STARTUP_LIBRARY is supposed to be a find_library definition
34
-      if( NOT STANDALONE_STARTUP_LIBRARY)
35
-         set( STANDALONE_STARTUP_LIBRARY ${STARTUP_LIBRARY})
36
-      endif()
45
+   # STARTUP_LIBRARY is supposed to be a find_library definition
46
+   if( NOT STANDALONE_STARTUP_LIBRARY)
47
+      set( STANDALONE_STARTUP_LIBRARY ${STARTUP_LIBRARY})
48
+   endif()
37 49
 
38
-      if( STANDALONE_STARTUP_LIBRARY)
39
-         set( STANDALONE_ALL_LOAD_LIBRARIES
40
-            ${STANDALONE_ALL_LOAD_LIBRARIES}
41
-            ${STANDALONE_STARTUP_LIBRARY}
42
-         )
43
-      endif()
50
+   if( STANDALONE_STARTUP_LIBRARY)
51
+      set( STANDALONE_ALL_LOAD_LIBRARIES
52
+         ${STANDALONE_ALL_LOAD_LIBRARIES}
53
+         ${STANDALONE_STARTUP_LIBRARY}
54
+      )
55
+   endif()
44 56
 
45 57
 
58
+   #
59
+   # If the main library is built as a shared library, we can't do it
60
+   #
61
+   if( BUILD_SHARED_LIBS)
62
+      message( WARNING "Standalone can not be built with BUILD_SHARED_LIBS set to ON")
63
+   else()
46 64
       #
47
-      # If the main library is built as a shared library, we can't do it
65
+      # Check for required standalone source file
48 66
       #
49
-      if( BUILD_SHARED_LIBS)
50
-         message( WARNING "Standalone can not be built with BUILD_SHARED_LIBS set to ON")
51
-      else()
52
-         #
53
-         # Check for required standalone source file
54
-         #
55
-         if( NOT STANDALONE_SOURCES)
56
-            message( FATAL_ERROR "You need to define STANDALONE_SOURCES. Add a file
57
-mulle-vararg-standalone.c with contents like this to it:
58
-   int  ___mulle_vararg_unused__;
67
+      if( NOT STANDALONE_SOURCES)
68
+         message( FATAL_ERROR "You need to define STANDALONE_SOURCES. Add a file
69
+${STANDALONE_NAME}.c with contents like this to it:
70
+int  ___mulle_vararg_unused__;
59 71
 and everybody will be happy")
60
-         endif()
72
+      endif()
73
+
74
+      #
75
+      # symbol prefixes to export on Windows, ignored on other platforms
76
+      #
77
+      if( NOT STANDALONE_SYMBOL_PREFIXES)
61 78
 
62
-         #
63
-         # symbol prefixes to export on Windows, ignored on other platforms
64
-         #
65
-         if( NOT STANDALONE_SYMBOL_PREFIXES)
79
+         set( STANDALONE_SYMBOL_PREFIXES "mulle"
80
+                 "_mulle"
81
+         )
66 82
 
67
-            set( STANDALONE_SYMBOL_PREFIXES "mulle"
68
-                    "_mulle"
83
+        if( "${MULLE_LANGUAGE}" MATCHES "ObjC")
84
+            set( STANDALONE_SYMBOL_PREFIXES
85
+               ${STANDALONE_SYMBOL_PREFIXES}
86
+               "Mulle"
87
+               "ns"
88
+               "NS"
89
+               "_Mulle"
90
+               "_ns"
91
+               "_NS"
69 92
             )
93
+        endif()
94
+      endif()
70 95
 
71
-           if( "${MULLE_LANGUAGE}" MATCHES "ObjC")
72
-               set( STANDALONE_SYMBOL_PREFIXES
73
-                  ${STANDALONE_SYMBOL_PREFIXES}
74
-                  "Mulle"
75
-                  "ns"
76
-                  "NS"
77
-                  "_Mulle"
78
-                  "_ns"
79
-                  "_NS"
80
-               )
81
-           endif()
82
-         endif()
83
-
84
-         #
85
-         # Make sure static libraries aren't optimized away
86
-         #
87
-         foreach( prefix ${STANDALONE_SYMBOL_PREFIXES})
88
-            list( APPEND STANDALONE_DUMPDEF_SYMBOL_PREFIXES "--prefix")
89
-            list( APPEND STANDALONE_DUMPDEF_SYMBOL_PREFIXES "${prefix}")
90
-         endforeach()
91
-
92
-         #
93
-         # On Windows we need to rexport symbols using a .def file
94
-         #
95
-         if( MSVC)
96
-            set( DEF_FILE "${STANDALONE_NAME}.def")
97
-            set_source_files_properties( ${DEF_FILE} PROPERTIES HEADER_FILE_ONLY TRUE)
98
-            set( CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
99
-            set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${DEF_FILE}")
100
-
101
-            message( STATUS "MSVC will generate \"${DEF_FILE}\" from ${TARGET_ALL_LOAD_LIBRARIES}")
102
-
103
-            add_custom_command( OUTPUT ${DEF_FILE}
104
-                                COMMAND mulle-mingw-dumpdef.bat -o "${DEF_FILE}"
105
-                                        --directory "${BUILD_RELATIVE_DEPENDENCY_DIR}/lib"
106
-                                        ${STANDALONE_DUMPDEF_SYMBOL_PREFIXES}
107
-                                        ${STANDALONE_ALL_LOAD_LIBRARIES}
108
-                                DEPENDS ${STANDALONE_ALL_LOAD_LIBRARIES}
109
-                                VERBATIM)
110
-         endif()
111
-
112
-
113
-         #
114
-         # if STANDALONE_SOURCE is not defined, cmake on windows "forgets" to
115
-         # produce the DEF_FILE.
116
-         #
117
-         # Also you get tedious linker warnings on other platforms. Creating the
118
-         # STANDALONE_SOURCES on the fly, is just not worth it IMO.
119
-         #
120
-         add_library( ${STANDALONE_NAME} SHARED
121
-            ${STANDALONE_SOURCES}
122
-            ${DEF_FILE}
123
-         )
124
-         set_property( TARGET ${STANDALONE_NAME} PROPERTY CXX_STANDARD 11)
96
+      #
97
+      # Make sure static libraries aren't optimized away
98
+      #
99
+      foreach( prefix ${STANDALONE_SYMBOL_PREFIXES})
100
+         list( APPEND STANDALONE_DUMPDEF_SYMBOL_PREFIXES "--prefix")
101
+         list( APPEND STANDALONE_DUMPDEF_SYMBOL_PREFIXES "${prefix}")
102
+      endforeach()
125 103
 
126
-         add_dependencies( ${STANDALONE_NAME} mulle-vararg)
127
-         if( STARTUP_NAME)
128
-            add_dependencies( ${STANDALONE_NAME} ${STARTUP_NAME})
129
-         endif()
104
+      #
105
+      # On Windows we need to rexport symbols using a .def file
106
+      #
107
+      if( MSVC)
108
+         set( DEF_FILE "${STANDALONE_NAME}.def")
109
+         set_source_files_properties( ${DEF_FILE} PROPERTIES HEADER_FILE_ONLY TRUE)
110
+         set( CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
111
+         set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${DEF_FILE}")
112
+
113
+         message( STATUS "MSVC will generate \"${DEF_FILE}\" from ${STANDALONE_ALL_LOAD_LIBRARIES}")
114
+
115
+         add_custom_command( OUTPUT ${DEF_FILE}
116
+                             COMMAND mulle-mingw-dumpdef.bat -o "${DEF_FILE}"
117
+                                     --directory "${BUILD_RELATIVE_DEPENDENCY_DIR}/lib"
118
+                                     ${STANDALONE_DUMPDEF_SYMBOL_PREFIXES}
119
+                                     ${STANDALONE_ALL_LOAD_LIBRARIES}
120
+                             DEPENDS ${STANDALONE_ALL_LOAD_LIBRARIES}
121
+                             VERBATIM)
122
+      endif()
130 123
 
131
-         # If STANDALONE_SOURCES were to be empty, this would be needed
132
-         # set_target_properties( ${STANDALONE_NAME} PROPERTIES LINKER_LANGUAGE "C")
133 124
 
134
-         # PRIVATE is a guess
135
-         target_compile_definitions( ${STANDALONE_NAME} PRIVATE ${STANDALONE_DEFINITIONS})
125
+      #
126
+      # if STANDALONE_SOURCE is not defined, cmake on windows "forgets" to
127
+      # produce the DEF_FILE.
128
+      #
129
+      # Also you get tedious linker warnings on other platforms. Creating the
130
+      # STANDALONE_SOURCES on the fly, is just not worth it IMO.
131
+      #
132
+      add_library( ${STANDALONE_NAME} SHARED
133
+         ${STANDALONE_SOURCES}
134
+         ${DEF_FILE}
135
+      )
136
+      set_property( TARGET ${STANDALONE_NAME} PROPERTY CXX_STANDARD 11)
136 137
 
137
-         #
138
-         # If you add DEPENDENCY_LIBRARIES to the static, adding them again to
139
-         # MulleObjCStandardFoundationStandalone confuses cmake it seems. But they
140
-         # are implicitly added.
141
-         #
142
-         # creates FORCE_STANDALONE_ALL_LOAD_LIBRARIES
138
+      add_dependencies( ${STANDALONE_NAME} ${LIBRARY_NAME})
139
+      if( STARTUP_NAME)
140
+         add_dependencies( ${STANDALONE_NAME} ${STARTUP_NAME})
141
+      endif()
143 142
 
144
-         CreateForceAllLoadList( STANDALONE_ALL_LOAD_LIBRARIES FORCE_STANDALONE_ALL_LOAD_LIBRARIES)
143
+      # If STANDALONE_SOURCES were to be empty, this would be needed
144
+      # set_target_properties( ${STANDALONE_NAME} PROPERTIES LINKER_LANGUAGE "C")
145 145
 
146
-         target_link_libraries( ${STANDALONE_NAME}
147
-            ${FORCE_STANDALONE_ALL_LOAD_LIBRARIES}
148
-         )
146
+      # PRIVATE is a guess
147
+      target_compile_definitions( ${STANDALONE_NAME} PRIVATE ${STANDALONE_DEFINITIONS})
149 148
 
150
-         set( INSTALL_LIBRARY_TARGETS
151
-            ${INSTALL_LIBRARY_TARGETS}
152
-            ${STANDALONE_NAME}
153
-         )
154
-      endif()
155
-   endif()
149
+      #
150
+      # If you add DEPENDENCY_LIBRARIES to the static, adding them again to
151
+      # MulleObjCStandardFoundationStandalone confuses cmake it seems. But they
152
+      # are implicitly added.
153
+      #
154
+      # creates FORCE_STANDALONE_ALL_LOAD_LIBRARIES
155
+
156
+      CreateForceAllLoadList( STANDALONE_ALL_LOAD_LIBRARIES FORCE_STANDALONE_ALL_LOAD_LIBRARIES)
157
+
158
+      target_link_libraries( ${STANDALONE_NAME}
159
+         ${FORCE_STANDALONE_ALL_LOAD_LIBRARIES}
160
+      )
156 161
 
162
+      set( INSTALL_LIBRARY_TARGETS
163
+         ${INSTALL_LIBRARY_TARGETS}
164
+         ${STANDALONE_NAME}
165
+      )
166
+   endif()
157 167
 endif()
... ...
@@ -1,32 +1,34 @@
1
-if( NOT __STARTUP_C__CMAKE__)
2
-   set( __STARTUP_C__CMAKE__ ON)
1
+# can be included multiple times
3 2
 
4
-   if( MULLE_TRACE_INCLUDE)
5
-      message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
6
-   endif()
3
+if( MULLE_TRACE_INCLUDE)
4
+   message( STATUS "# Include \"${CMAKE_CURRENT_LIST_FILE}\"" )
5
+endif()
7 6
 
8
-   if( STARTUP_SOURCES)
9
-      if( NOT STARTUP_NAME)
10
-         set( STARTUP_NAME "mulle-vararg-startup")
11
-      endif()
7
+if( STARTUP_SOURCES)
8
+   if( NOT STARTUP_NAME)
9
+      set( STARTUP_NAME "mulle-vararg-startup")
10
+   endif()
11
+   if( NOT STARTUP_DEFINITIONS)
12 12
       set( STARTUP_DEFINITIONS ${MULLE_VARARG_DEFINITIONS})
13
+   endif()
13 14
 
14
-      add_library( ${STARTUP_NAME} STATIC
15
-         ${STARTUP_SOURCES}
16
-      )
17
-      set_property( TARGET ${STARTUP_NAME} PROPERTY CXX_STANDARD 11)
15
+   add_library( ${STARTUP_NAME} STATIC
16
+      ${STARTUP_SOURCES}
17
+   )
18
+   set_property( TARGET ${STARTUP_NAME} PROPERTY CXX_STANDARD 11)
18 19
 
19
-      target_compile_definitions( ${STARTUP_NAME} PRIVATE ${STARTUP_DEFINITIONS})
20
+   target_compile_definitions( ${STARTUP_NAME} PRIVATE ${STARTUP_DEFINITIONS})
20 21
 
21
-      set( INSTALL_LIBRARY_TARGETS
22
-         ${INSTALL_LIBRARY_TARGETS}
23
-         ${STARTUP_NAME}
24
-      )
22
+   set( INSTALL_LIBRARY_TARGETS
23
+      ${INSTALL_LIBRARY_TARGETS}
24
+      ${STARTUP_NAME}
25
+   )
25 26
 
26
-      set( STARTUP_LIBRARY
27
-         $<TARGET_FILE:${STARTUP_NAME}>
28
-      )
29
-   endif()
27
+   message( STATUS "STARTUP_NAME=\"${STARTUP_NAME}\"")
30 28
 
31
-   include( StartupCAux OPTIONAL)
29
+   set( STARTUP_LIBRARY
30
+      $<TARGET_FILE:${STARTUP_NAME}>
31
+   )
32 32
 endif()
33
+
34
+include( StartupCAux OPTIONAL)
... ...
@@ -14,7 +14,7 @@
14 14
 //
15 15
 // community version is always even
16 16
 //
17
-#define MULLE_VARARG_VERSION  ((1 << 20) | (0 << 8) | 4)
17
+#define MULLE_VARARG_VERSION  ((1 << 20) | (0 << 8) | 5)
18 18
 
19 19
 
20 20
 /*