summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-20 13:22:25 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-03-20 13:22:25 (GMT)
commitb048a3edd031f1674c912353c968087a9f059ea3 (patch)
tree336b00dd05d915bb33f0118bb4aa613e14f4dd88 /Tests/RunCMake
parent82c590b12ed7301539202b0af92f8181f7708f16 (diff)
parentcc5a0d8f42f9ad8bc5ac50be343db05128a0c6ea (diff)
downloadCMake-b048a3edd031f1674c912353c968087a9f059ea3.zip
CMake-b048a3edd031f1674c912353c968087a9f059ea3.tar.gz
CMake-b048a3edd031f1674c912353c968087a9f059ea3.tar.bz2
Merge topic 'FindPkgConfig_Extend-PKG_CONFIG_PATH_2'
cc5a0d8f FindPkgConfig: More unit tests 453d2b24 FindPkgConfig: small refactoring
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake41
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake2
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake51
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake51
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake3
-rwxr-xr-xTests/RunCMake/FindPkgConfig/dummy-pkg-config.bat2
-rwxr-xr-xTests/RunCMake/FindPkgConfig/dummy-pkg-config.sh4
7 files changed, 151 insertions, 3 deletions
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake
new file mode 100644
index 0000000..924976e
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake
@@ -0,0 +1,41 @@
+# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS
+enable_language(C)
+
+# Prepare environment and variables
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE)
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo")
+if(WIN32)
+ set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat")
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem")
+ set(ENV{PKG_CONFIG_PATH} "C:\\baz")
+else()
+ set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh")
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem")
+ set(ENV{PKG_CONFIG_PATH} "/baz")
+endif()
+
+
+find_package(PkgConfig)
+
+if(WIN32)
+ set(expected_path "C:\\baz")
+else()
+ set(expected_path "/baz")
+endif()
+
+
+pkg_check_modules(FOO "${expected_path}")
+
+if(NOT "FOO_FOUND")
+ message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".")
+endif()
+
+
+
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
+
+pkg_check_modules(BAR "${expected_path}" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH)
+
+if(NOT "BAR_FOUND")
+ message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".")
+endif()
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake
index 5f9913f..4a66e85 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake
@@ -44,7 +44,7 @@ else()
endif()
-pkg_check_modules (FOO "${expected_path}")
+pkg_check_modules(FOO "${expected_path}")
if(NOT "FOO_FOUND")
message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".")
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake
new file mode 100644
index 0000000..0b057b8
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake
@@ -0,0 +1,51 @@
+# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS
+enable_language(C)
+
+# Prepare environment and variables
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo")
+if(WIN32)
+ set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat")
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem")
+ set(ENV{PKG_CONFIG_PATH} "C:\\baz")
+else()
+ set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh")
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem")
+ set(ENV{PKG_CONFIG_PATH} "/baz")
+endif()
+
+
+find_package(PkgConfig)
+
+
+if(NOT DEFINED CMAKE_SYSTEM_NAME
+ OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+ AND NOT CMAKE_CROSSCOMPILING))
+ if(EXISTS "/etc/debian_version") # is this a debian system ?
+ if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$")
+ # Cannot create directories for all the existing architectures...
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig")
+ else()
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig")
+ endif()
+ else()
+ # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+ get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+ if(uselib64)
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig")
+ endif()
+ endif()
+else()
+ if(WIN32)
+ set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-foo\\lib\\pkgconfig")
+ else()
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-foo/lib/pkgconfig")
+ endif()
+endif()
+
+
+pkg_check_modules(FOO "${expected_path}" NO_CMAKE_ENVIRONMENT_PATH)
+
+if(NOT "FOO_FOUND")
+ message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".")
+endif()
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake
new file mode 100644
index 0000000..a3154f1
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake
@@ -0,0 +1,51 @@
+# Needed for CMAKE_SYSTEM_NAME, CMAKE_LIBRARY_ARCHITECTURE and FIND_LIBRARY_USE_LIB64_PATHS
+enable_language(C)
+
+# Prepare environment and variables
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-foo")
+if(WIN32)
+ set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat")
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem")
+ set(ENV{PKG_CONFIG_PATH} "C:\\baz")
+else()
+ set(PKG_CONFIG_EXECUTABLE "${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh")
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bar:/this/directory/should/not/exist/in/the/filesystem")
+ set(ENV{PKG_CONFIG_PATH} "/baz")
+endif()
+
+
+find_package(PkgConfig)
+
+
+if(NOT DEFINED CMAKE_SYSTEM_NAME
+ OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+ AND NOT CMAKE_CROSSCOMPILING))
+ if(EXISTS "/etc/debian_version") # is this a debian system ?
+ if(CMAKE_LIBRARY_ARCHITECTURE MATCHES "^(i386-linux-gnu|x86_64-linux-gnu)$")
+ # Cannot create directories for all the existing architectures...
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig")
+ else()
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig")
+ endif()
+ else()
+ # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+ get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+ if(uselib64)
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib64/pkgconfig:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig")
+ endif()
+ endif()
+else()
+ if(WIN32)
+ set(expected_path "C:\\baz;${CMAKE_CURRENT_SOURCE_DIR}\\pc-bar\\lib\\pkgconfig")
+ else()
+ set(expected_path "/baz:${CMAKE_CURRENT_SOURCE_DIR}/pc-bar/lib/pkgconfig")
+ endif()
+endif()
+
+
+pkg_check_modules(FOO "${expected_path}" NO_CMAKE_PATH)
+
+if(NOT "FOO_FOUND")
+ message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".")
+endif()
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index ad77ad0..bca93bb 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -1,3 +1,6 @@
include(RunCMake)
+run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH)
run_cmake(FindPkgConfig_PKGCONFIG_PATH)
+run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH)
+run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH)
diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat
index b2096ed..f2f86b0 100755
--- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat
+++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.bat
@@ -9,6 +9,8 @@ IF "%1"=="--version" (
IF "%1"=="--exists" (
SHIFT
+ ECHO Expected: %*
+ ECHO Found: %PKG_CONFIG_PATH%
IF NOT "%*"=="%PKG_CONFIG_PATH%" (
EXIT /B 1
)
diff --git a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh
index e62bb74..852e841 100755
--- a/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh
+++ b/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh
@@ -10,8 +10,8 @@ case $1 in
;;
--exists)
shift
- echo "$@"
- echo "${PKG_CONFIG_PATH}"
+ echo "Expected: $@"
+ echo "Found: ${PKG_CONFIG_PATH}"
[ "$@" = "${PKG_CONFIG_PATH}" ] || exit 1
;;
*)