Skip to content

Commit 5a0a1c9

Browse files
committed
Clean up test CMakeLists.txt
1 parent 7d8f5c4 commit 5a0a1c9

1 file changed

Lines changed: 10 additions & 38 deletions

File tree

test/CMakeLists.txt

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,8 @@ project(test_findFFTW NONE)
44
# Add the parent directory (repo root) to the module path so CMake can find FindFFTW.cmake
55
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/..")
66

7-
# ---------------------------------------------------------------------------
8-
# Build find_package arguments
9-
# ---------------------------------------------------------------------------
10-
11-
# Resolve version argument from FFTW_TEST_VERSION
12-
set(_fftw_find_version "")
13-
if(DEFINED FFTW_TEST_VERSION)
14-
set(_fftw_find_version "${FFTW_TEST_VERSION}")
15-
endif()
16-
17-
# Collect COMPONENTS argument
18-
set(_fftw_components "")
19-
if(DEFINED FFTW_TEST_COMPONENTS)
20-
set(_fftw_components COMPONENTS ${FFTW_TEST_COMPONENTS})
21-
endif()
22-
237
# Call find_package with the assembled arguments
24-
if(_fftw_find_version)
25-
find_package(FFTW ${_fftw_find_version} REQUIRED ${_fftw_components})
26-
else()
27-
find_package(FFTW REQUIRED ${_fftw_components})
28-
endif()
8+
find_package(FFTW ${FFTW_TEST_VERSION} REQUIRED ${FFTW_TEST_COMPONENTS})
299

3010
# ---------------------------------------------------------------------------
3111
# Check that the basic variables are set
@@ -34,33 +14,25 @@ if(NOT FFTW_FOUND)
3414
message(FATAL_ERROR "FFTW_FOUND is not TRUE after find_package(FFTW REQUIRED)")
3515
endif()
3616

37-
if("${FFTW_VERSION}" STREQUAL "")
38-
message(FATAL_ERROR "FFTW_VERSION is empty after find_package(FFTW REQUIRED)")
39-
endif()
40-
41-
if("${FFTW_INCLUDE_DIRS}" STREQUAL "")
17+
if(NOT FFTW_INCLUDE_DIRS)
4218
message(FATAL_ERROR "FFTW_INCLUDE_DIRS is empty after find_package(FFTW REQUIRED)")
4319
endif()
4420

45-
if("${FFTW_LIBRARIES}" STREQUAL "")
21+
if(NOT FFTW_LIBRARIES)
4622
message(FATAL_ERROR "FFTW_LIBRARIES is empty after find_package(FFTW REQUIRED)")
4723
endif()
4824

25+
if(NOT FFTW_VERSION)
26+
message(FATAL_ERROR "FFTW_VERSION is empty after find_package(FFTW REQUIRED)")
27+
endif()
28+
4929
# ---------------------------------------------------------------------------
5030
# Version checks
5131
# ---------------------------------------------------------------------------
52-
if(_fftw_find_version)
53-
if("${FFTW_VERSION}" STREQUAL "")
54-
message(FATAL_ERROR
55-
"FFTW_VERSION is not set after find_package. "
56-
"Version detection requires pkg-config, which is not used when "
57-
"FFTW_ROOT is set or pkg-config is unavailable. "
58-
"Do not set FFTW_TEST_VERSION when using FFTW_ROOT.")
59-
endif()
60-
61-
if(NOT "${FFTW_VERSION}" VERSION_GREATER_EQUAL "${_fftw_find_version}")
32+
if(FFTW_TEST_VERSION)
33+
if(NOT "${FFTW_VERSION}" VERSION_GREATER_EQUAL "${FFTW_TEST_VERSION}")
6234
message(FATAL_ERROR
63-
"Expected FFTW_VERSION >= ${_fftw_find_version} but got ${FFTW_VERSION}")
35+
"Expected FFTW_VERSION >= ${FFTW_TEST_VERSION} but got ${FFTW_VERSION}")
6436
endif()
6537
endif()
6638

0 commit comments

Comments
 (0)