Skip to content
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

README: Adding ExternalProject_Add example #652

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,21 @@ cd AppImageKit/
sudo bash -ex install-build-deps.sh
bash -ex build.sh
```

## Embedding into your project (CMake)

The following example is based on the build.sh script above, but gives the possibility to build AppImageKit together with your software. The section below is a snippet of a CMake script.

```
if(BUILD_OS_LINUX)
ExternalProject_Add(AppImageKit
GIT_REPOSITORY https://github.com/AppImage/AppImageKit.git
GIT_TAG appimagetool/master
GIT_SUBMODULES ""
CMAKE_COMMAND ${CMAKE_COMMAND} -E env "PATH=${CMAKE_INSTALL_PREFIX}/bin/:$ENV{PATH}" "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/" "LDFLAGS=-L${CMAKE_INSTALL_PREFIX}/lib" "CPPFLAGS=-I${CMAKE_INSTALL_PREFIX}/include" ${CMAKE_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON
)

SetProjectDependencies(TARGET AppImageKit DEPENDS glib libfuse cairo OpenSSL patch sed wget)
Copy link
Contributor

@azubieta azubieta Nov 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seems to be a native CMake function. I suppose it's a custom macro.
In order to allow other user to reuse your code snippet you must only use native functions.

endif()
```