aboutsummaryrefslogtreecommitdiff
path: root/test/postinstall/c_app/CMakeLists.txt
diff options
context:
space:
mode:
authorMike Taves <mwtoews@gmail.com>2021-12-09 00:45:03 +1300
committerGitHub <noreply@github.com>2021-12-09 00:45:03 +1300
commit7a9b6566ac02d8c408f4f3758bfa5fcc3e90b552 (patch)
treed71d0771cc9f95d5a8ea96bd975bbd4164188813 /test/postinstall/c_app/CMakeLists.txt
parent1b18defb63c7d2420d18e4375348663874247838 (diff)
downloadPROJ-7a9b6566ac02d8c408f4f3758bfa5fcc3e90b552.tar.gz
PROJ-7a9b6566ac02d8c408f4f3758bfa5fcc3e90b552.zip
Refactor post-install suite to test shared and static projlib (#2972)
Diffstat (limited to 'test/postinstall/c_app/CMakeLists.txt')
-rw-r--r--test/postinstall/c_app/CMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/postinstall/c_app/CMakeLists.txt b/test/postinstall/c_app/CMakeLists.txt
new file mode 100644
index 00000000..a493849b
--- /dev/null
+++ b/test/postinstall/c_app/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required(VERSION 3.5)
+project(C_APP LANGUAGES C)
+
+set(USE_PROJ_NAME "PROJ"
+ CACHE STRING "Either PROJ (default) or PROJ4")
+
+find_package(${USE_PROJ_NAME} REQUIRED CONFIG)
+
+include(CMakePrintHelpers)
+cmake_print_properties(
+ TARGETS ${USE_PROJ_NAME}::proj
+ PROPERTIES
+ LOCATION
+ INTERFACE_INCLUDE_DIRECTORIES
+ INTERFACE_LINK_LIBRARIES
+ INTERFACE_COMPILE_FEATURES
+)
+
+add_executable(c_app c_app.c)
+target_link_libraries(c_app PRIVATE ${USE_PROJ_NAME}::proj)
+
+get_target_property(PROJLIB_LOCATION ${USE_PROJ_NAME}::proj LOCATION)
+if(PROJLIB_LOCATION MATCHES ".*\.(lib|a)$")
+ # Used for static linking (is there a better way?)
+ enable_language(CXX)
+ set_target_properties(c_app PROPERTIES LINKER_LANGUAGE CXX)
+endif()
+
+set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/..)
+include(common)
+add_test_ldd(c_app proj)
+add_test_transform(c_app)
+add_test_searchpath(c_app)
+add_test_version(c_app)