diff options
author | Hiroshi Miura <miurahr@linux.com> | 2021-10-06 00:39:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-10-06 15:20:35 (GMT) |
commit | 524205a7a520abc77283103c01e0098d2d008a8f (patch) | |
tree | 75bc003193fcd7c69ee0cc8393ee99a9bba11452 | |
parent | 49392b591dd32732d101e7983f528f6560e7f7b5 (diff) | |
download | CMake-524205a7a520abc77283103c01e0098d2d008a8f.zip CMake-524205a7a520abc77283103c01e0098d2d008a8f.tar.gz CMake-524205a7a520abc77283103c01e0098d2d008a8f.tar.bz2 |
FindJasper: Modernize code layout
-rw-r--r-- | Modules/FindJasper.cmake | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake index 729a503..9bb4dd8 100644 --- a/Modules/FindJasper.cmake +++ b/Modules/FindJasper.cmake @@ -18,30 +18,26 @@ Once done this will define #]=======================================================================] find_path(JASPER_INCLUDE_DIR jasper/jasper.h) +mark_as_advanced(JASPER_INCLUDE_DIR) -if (NOT JASPER_LIBRARIES) - find_package(JPEG) - - find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper) - find_library(JASPER_LIBRARY_DEBUG NAMES jasperd) - - include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) - SELECT_LIBRARY_CONFIGURATIONS(JASPER) -endif () - -if (JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h") - file(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*") +if(NOT JASPER_LIBRARIES) + find_package(JPEG) + find_library(JASPER_LIBRARY_RELEASE NAMES jasper libjasper) + find_library(JASPER_LIBRARY_DEBUG NAMES jasperd) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(JASPER) +endif() - string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}") -endif () +if(JASPER_INCLUDE_DIR AND EXISTS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h") + file(STRINGS "${JASPER_INCLUDE_DIR}/jasper/jas_config.h" jasper_version_str REGEX "^#define[\t ]+JAS_VERSION[\t ]+\".*\".*") + string(REGEX REPLACE "^#define[\t ]+JAS_VERSION[\t ]+\"([^\"]+)\".*" "\\1" JASPER_VERSION_STRING "${jasper_version_str}") +endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper +find_package_handle_standard_args(Jasper REQUIRED_VARS JASPER_LIBRARIES JASPER_INCLUDE_DIR JPEG_LIBRARIES VERSION_VAR JASPER_VERSION_STRING) -if (JASPER_FOUND) - set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES} ) -endif () - -mark_as_advanced(JASPER_INCLUDE_DIR) +if(JASPER_FOUND) + set(JASPER_LIBRARIES ${JASPER_LIBRARIES} ${JPEG_LIBRARIES}) +endif() |