-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libpngconf.c is attached to multiple targets #394
Comments
this seems to be fixed with the following --- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -263,11 +263,17 @@ if(UNIX)
symbol_prefix()
endif()
-find_program(AWK NAMES gawk awk)
+if(CMAKE_GENERATOR MATCHES "Xcode" AND CMAKE_XCODE_BUILD_SYSTEM MATCHES 12)
+ message(WARNING "libpng does not currently support generating files for multiple targets using the Xcode \"new build system\", libpng will use the prebuilt pnglibconf instead")
+ set(PNG_XCODE_NEW_BUILD_SYSTEM true)
+else()
+ set(PNG_XCODE_NEW_BUILD_SYSTEM false)
+ find_program(AWK NAMES gawk awk)
+endif()
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-if(NOT AWK OR ANDROID OR IOS)
+if (PNG_XCODE_NEW_BUILD_SYSTEM OR NOT AWK OR ANDROID OR IOS)
# No awk available to generate sources; use pre-built pnglibconf.h
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
@@ -449,7 +455,7 @@ else()
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
"${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
-endif(NOT AWK OR ANDROID OR IOS)
+endif(PNG_XCODE_NEW_BUILD_SYSTEM OR NOT AWK OR ANDROID OR IOS)
# List the source code files.
set(libpng_public_hdrs
@@ -463,8 +469,10 @@ set(libpng_private_hdrs
pnginfo.h
pngstruct.h
)
-if(AWK AND NOT ANDROID AND NOT IOS)
+if(NOT PNG_XCODE_NEW_BUILD_SYSTEM AND AWK AND NOT ANDROID AND NOT IOS)
list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
endif()
set(libpng_sources
${libpng_public_hdrs} |
There is a clean fix in #403 |
I am facing the same error while building libpng 1.6.37 (because that is the version that is currently snapshotted in the latest version of the ImageMagick source distribution) with Xcode 12.4. Although #403 was applied to 1.6.38, I locally applied the changes from #403 to CMakeLists.txt for version 1.6.37, but I still get "attached to multiple targets" errors, although now it identifies different problem targets than before: [08:31:15] : [Step 2/5] CMake Error in CMakeLists.txt: I do not claim to understand what "none of these is a common dependency of the other(s)" means. The custom command that generates sym.out is:
The rules for the gensym target are:
The genfiles target depends on both the scripts_sym_out target and the gensym target:
I believe this is exactly the state of affairs that results from #403, but it is not working in the context of the 1.6.37 CMakeLists.txt. |
v1.6.37 is older than the current libpng16 branch. If my fix is merged, the issue will be fixed in the next 1.6 release |
I understand. However, I have to work with what is available to me now, so I took matters into my own hands by applying the same changes to the older version. The 1.6.37 and 1.6.38 CMakeLists.txt are similar enough that the #403 changes were pretty straightforward to apply. |
The more expedient solution in my case was to invoke CMake with "-T buildsystem=1", which tells it to use the old XCode build system that can tolerate the libpng CMakeLists.txt design. |
Fixed. |
CMake Error in /Users/smallville7123/StudioProjects/Graphical-Tool-Kit/app/src/main/cpp/freetype-cmake/libpng/CMakeLists.txt:
The custom command generating
is attached to multiple targets:
but none of these is a common dependency of the other(s). This is not
allowed by the Xcode "new build system".
when generating cmake project for XCode
The text was updated successfully, but these errors were encountered: