Comments (2)
Unfortunately, this problem is difficult to tackle with the way CMakeGenerator currently uses the CMake logic.
The core problem is we're using target_link_libraries recursively which doesn't provide a mechanism to tell CMake how to build a dependency graph.
Concretely, this is what CMakeGenerator builds:
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
if(CMAKE_SYSTEM_VERSION GREATER 20)
if(cdep_determined_android_abi STREQUAL "x86_64")
add_cdep_boringssl_dependency(${target})
add_cdep_zlib_dependency(${target})
execute_process(COMMAND /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -classpath /home/swinston/.cdep/bootstrap/downloads/-1010138560/cdep-0.8.22.jar io.cdep.CDep --working-folder /mount/120g/temp/. fetch-archive com.github.gpx1000:curl:7.56.0 file:/mount/120g/temp/curlUpload/curl-x86_64.zip 2084333 03a716990b06ddffacacb844a759b9e9d8605ef8c5d5d9ac6fbb9414fe83e839)^M
target_link_libraries(${target} "${exploded_archive_folder}/curl-x86_64.zip/lib/x86_64/libcurl.a")
Now the problem is both add_cdep_boringssl_dependency and add_cdep_zlib_dependency will similarly issue a target_link_libraries call so in effect this is the same thing as if one were to write this in a cmakelists.txt file:
target_link_libraries(${target} /libssl.a)
target_link_libraries(${target} /libz.a)
target_link_libraries(${target} /libcurl.a)
The bug is this prevents cmake from realizing that the dependency graph should note that curl depends upon z and ssl.
To fix this, I'd suggest the following ideas:
1.) switch to declaring each as a taget with add_library:
add_library( libName STATIC IMPORTED );
set_target_properties( libName PROPERTIES IMPORTED_LOCATION visit(LibraryPath) INTERFACE_INCLUDE_DIRECTORIES specific.includePath)
Then if any dependencies are noticed:
target_link_libraries( libName recursiveLibNameList )
target_link_libraries( ${target} libName )
or concretely (I've already implemented this version):
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
if(CMAKE_SYSTEM_VERSION GREATER 20)
if(cdep_determined_android_abi STREQUAL "armeabi")
execute_process(COMMAND "java" )
add_library(libcurl STATIC IMPORTED )
set_target_properties(libcurl PROPERTIES IMPORTED_LOCATION "${exploded_archive_folder}/curl-armeabi.zip/lib/armeabi/libcurl.a")
target_link_libraries(libcurl ssl crypto z)
target_link_libraries(${target} libcurl)
The downside of this method is it ads in lots of targets to an already existing project; which might have issues with stepping on already allocated names from elsewhere.
An alternative solution would be similar to this:
2.) Reuse the package logic found here:
https://cmake.org/cmake/help/v3.7/manual/cmake-packages.7.html
This can probably work in addition to the first solution, it would make sense to consider placing the generated package into a cmake folder in the same directory as the CMakeLists.txt that calls the package. Changing the path to make it more visible would encourage a solution for not stepping on target names. Also keeping it as a separate project allows the dependency graph in CMake to handle things like circular dependencies correctly.
from cdep.
This issue is addressed. In PR #52
from cdep.
Related Issues (20)
- include should be abi capable HOT 1
- On android-studio-cmake.md it's not clear which build.gradle file to edit
- Error:ABIs [armeabie] are not available for platform...
- List of pros and cons of CDep
- more than one example
- CFlags ldFlags promotion HOT 1
- cdep-manifest.yml parsing
- improve authoring.md step 14 HOT 1
- ndk-build spaces vs tabs
- Error: SHA256 on Step 13 of the authoring guide HOT 2
- strange error when building cdep sample: CMAKE_SYSTEM_VERSION is 1 HOT 2
- ios support HOT 9
- CMAKE_SYSTEM_VERSION is 24 HOT 3
- gitlab support HOT 2
- libxml2 package
- Error with CMakeLists.txt HOT 1
- There is a vulnerability in SnakeYAML 1.17,upgrade recommended
- Security Policy violation Binary Artifacts HOT 134
- https://raw.githubusercontent.com/jomof/cdep/master/boot.yml HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdep.