diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-10-24 23:17:59 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-10-25 18:20:06 +0200 |
| commit | 37d141a5d666952824292be84ad854f4fe45e163 (patch) | |
| tree | 2e54202c97651bcee080364ea4e9b4acc9c32ccd /travis | |
| parent | 9817fe7db31d5a0716876e1f8f7f1a9ba4b91be0 (diff) | |
| download | PROJ-37d141a5d666952824292be84ad854f4fe45e163.tar.gz PROJ-37d141a5d666952824292be84ad854f4fe45e163.zip | |
lib_proj.cmake: add a PROJ::proj alias and add BUILD_INTERFACE include directories, so that proj can be used as a subdirectory of a larger project (fixes #2905)
Diffstat (limited to 'travis')
| -rwxr-xr-x | travis/install.sh | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/travis/install.sh b/travis/install.sh index a07e7784..d0b4d9cb 100755 --- a/travis/install.sh +++ b/travis/install.sh @@ -115,10 +115,33 @@ fi if [ "$BUILD_NAME" != "linux_gcc8" -a "$BUILD_NAME" != "linux_gcc_32bit" ]; then - # cmake build from generated tarball + cmake --version + + # Build PROJ as a subproject + mkdir proj_as_subproject + cd proj_as_subproject + mkdir external + ln -s $PWD/.. external/PROJ + + echo '#include "proj.h"' > mytest.c + echo 'int main() { proj_info(); return 0; }' >> mytest.c + + echo 'cmake_minimum_required(VERSION 3.9)' > CMakeLists.txt + echo 'project(mytest)' >> CMakeLists.txt + echo 'add_subdirectory(external/PROJ)' >> CMakeLists.txt + echo 'add_executable(mytest mytest.c)' >> CMakeLists.txt + echo 'target_include_directories(mytest PRIVATE $<TARGET_PROPERTY:PROJ::proj,INTERFACE_INCLUDE_DIRECTORIES>)' >> CMakeLists.txt + echo 'target_link_libraries(mytest PRIVATE PROJ::proj)' >> CMakeLists.txt + + mkdir build_cmake + cd build_cmake + cmake .. -DCMAKE_BUILD_TYPE=Debug + VERBOSE=1 make >/dev/null + cd ../.. + + # Regular build mkdir build_cmake cd build_cmake - cmake --version cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/proj_cmake_install VERBOSE=1 make >/dev/null make install >/dev/null |
