You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When compiling static objects, passing -mmacos-version-min=<version> as an option via cmake .. -DCMAKE_C_FLAGS_INIT="-mmacos-version-min=<version>" doesn't apply to the built objects.
This can be seen when building a library with the static objects generated from make. Example below:
Example
$ sw_vers -productVersion
-> 14.4.1
$ cmake .. -DCMAKE_C_FLAGS_INIT="-mmacos-version-min=14.0" -DENABLE_CJSON_UTILS=On -DENABLE_CJSON_TEST=Off -DBUILD_SHARED_AND_STATIC_LIBS=On
$ make
$ mkdir -p cjson_tmp
$ cd cjson_tmp
$ ar x ../build/libcjson.a
$ ls
-> ... cjson.c.o
$ gcc -fcommon -shared -o lib.so -fPIC -Ideps -Ideps/b64 -IcJSON cjson_tmp/*.o
-> warning: object file (cjson_tmp/cjson.c.o) was built for newer 'macOS' version (14.4) than being linked (14.0)
Solution
add an option for macos min version:
option(MACOS_VERSION_MIN "Set the minimum macOS SDK version"OFF)
if (APPLE AND MACOS_VERSION_MIN)
add_compile_options(-mmacos-version-min=${MACOS_VERSION_MIN})
endif()
The text was updated successfully, but these errors were encountered:
Problem
-mmacos-version-min=<version>
as an option viacmake .. -DCMAKE_C_FLAGS_INIT="-mmacos-version-min=<version>"
doesn't apply to the built objects.make
. Example below:Example
Solution
add an option for macos min version:
The text was updated successfully, but these errors were encountered: