summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ringer <jonringer117@gmail.com>2021-11-08 06:47:25 -0800
committerAzat Khuzhin <azat@libevent.org>2023-05-14 22:43:47 +0200
commitbe03bf385b0dccec189af71af71e0af0b402ebdb (patch)
tree46d442699cd133306b81668122bb10b773c14e57
parent1f1593ff27bdf51c3e1c45b92cfb0ac931960298 (diff)
downloadlibevent-be03bf385b0dccec189af71af71e0af0b402ebdb.tar.gz
Install LibeventConfig.cmake similar to other cmake files
- Don't destroy cmake file between test case invocations
-rw-r--r--CMakeLists.txt22
-rw-r--r--test-export/test-export.py16
2 files changed, 4 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b6ad7e1..8c88ba56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1628,18 +1628,9 @@ set(EVENT_INSTALL_CMAKE_DIR
export(PACKAGE libevent)
-function(gen_package_config forinstall)
- if(${forinstall})
- set(CONFIG_FOR_INSTALL_TREE 1)
- set(dir "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}")
- else()
- set(CONFIG_FOR_INSTALL_TREE 0)
- set(dir "${PROJECT_BINARY_DIR}")
- endif()
- configure_file(${PROJECT_SOURCE_DIR}/cmake/LibeventConfig.cmake.in
- "${dir}/LibeventConfig.cmake"
- @ONLY)
-endfunction()
+configure_file(${PROJECT_SOURCE_DIR}/cmake/LibeventConfig.cmake.in
+ "${PROJECT_BINARY_DIR}/LibeventConfig.cmake"
+ @ONLY)
# Generate the config file for the build-tree.
set(EVENT__INCLUDE_DIRS
@@ -1650,11 +1641,6 @@ set(LIBEVENT_INCLUDE_DIRS
${EVENT__INCLUDE_DIRS}
CACHE PATH "Libevent include directories")
-gen_package_config(0)
-
-# Generate the config file for the installation tree.
-gen_package_config(1)
-
# Generate version info for both build-tree and install-tree.
configure_file(${PROJECT_SOURCE_DIR}/cmake/LibeventConfigVersion.cmake.in
${PROJECT_BINARY_DIR}/LibeventConfigVersion.cmake
@@ -1672,7 +1658,7 @@ install(FILES ${HDR_PUBLIC}
# Install the configs.
install(FILES
- ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/LibeventConfig.cmake
+ ${PROJECT_BINARY_DIR}/LibeventConfig.cmake
${PROJECT_BINARY_DIR}/LibeventConfigVersion.cmake
DESTINATION "${EVENT_INSTALL_CMAKE_DIR}"
COMPONENT dev)
diff --git a/test-export/test-export.py b/test-export/test-export.py
index 9eaf0d63..84824350 100644
--- a/test-export/test-export.py
+++ b/test-export/test-export.py
@@ -109,18 +109,6 @@ def test_group():
testcase("mbedtls", "pthreads", 1)
-def config_restore():
- if os.path.isfile("tempconfig") and not os.path.isfile("LibeventConfig.cmake"):
- os.rename("tempconfig", "LibeventConfig.cmake")
-
-
-def config_backup():
- if os.path.isfile("tempconfig"):
- os.remove("tempconfig")
- if os.path.isfile("LibeventConfig.cmake"):
- os.rename("LibeventConfig.cmake", "tempconfig")
-
-
shutil.rmtree(os.path.join(script_dir, "build"), ignore_errors=True)
@@ -158,7 +146,6 @@ print("[test-export] use %s library" % link_type)
# Test for build tree.
print("[test-export] test for build tree")
dllpath = os.path.join(working_dir, "bin", "Debug")
-config_restore()
os.environ["CMAKE_PREFIX_PATH"] = working_dir
export_dll(dllpath)
run_test_group()
@@ -175,7 +162,6 @@ else:
prefix = "/usr/local"
exec_cmd('cmake -DCMAKE_SKIP_INSTALL_RPATH=OFF -DCMAKE_INSTALL_PREFIX="%s" ..' % prefix, True)
exec_cmd('cmake --build . -v --target install', True)
-config_backup()
os.environ["CMAKE_PREFIX_PATH"] = os.path.join(prefix, "lib/cmake/libevent")
export_dll(dllpath)
run_test_group()
@@ -191,13 +177,11 @@ tempdir = tempfile.TemporaryDirectory()
cmd = 'cmake -DCMAKE_SKIP_INSTALL_RPATH=OFF -DCMAKE_INSTALL_PREFIX="%s" ..' % tempdir.name
exec_cmd(cmd, True)
exec_cmd("cmake --build . -v --target install", True)
-config_backup()
os.environ["CMAKE_PREFIX_PATH"] = os.path.join(tempdir.name, "lib/cmake/libevent")
dllpath = os.path.join(tempdir.name, "lib")
export_dll(dllpath)
run_test_group()
unexport_dll(dllpath)
del os.environ["CMAKE_PREFIX_PATH"]
-config_restore()
print("[test-export] all testcases have run successfully")