@@ -19,64 +19,6 @@ if(SimdjsonAlt_FOUND)
1919 return ()
2020endif ()
2121
22- if (simdjson_ROOT)
23- find_path (SIMDJSON_INCLUDE_DIR
24- NAMES simdjson.h
25- PATHS ${simdjson_ROOT}
26- NO_DEFAULT_PATH
27- PATH_SUFFIXES "include" )
28- find_library (SIMDJSON_LIBRARY
29- NAMES simdjson
30- PATHS ${simdjson_ROOT}
31- NO_DEFAULT_PATH
32- PATH_SUFFIXES "lib" "lib64" )
33- else ()
34- find_path (SIMDJSON_INCLUDE_DIR
35- NAMES simdjson.h
36- PATH_SUFFIXES "include" )
37- find_library (SIMDJSON_LIBRARY
38- NAMES simdjson
39- PATH_SUFFIXES "lib" "lib64" )
40- endif ()
41-
42- if (SIMDJSON_INCLUDE_DIR AND SIMDJSON_LIBRARY)
43- # Found via manual search
44- file (READ "${SIMDJSON_INCLUDE_DIR} /simdjson.h" SIMDJSON_H_CONTENT )
45- string (REGEX MATCH "#define SIMDJSON_VERSION \" ([0-9]+\\ .[0-9]+\\ .[0-9]+)\" "
46- SIMDJSON_VERSION_DEFINITION "${SIMDJSON_H_CONTENT} " )
47- string (REGEX REPLACE "^.+ \" ([0-9]+\\ .[0-9]+\\ .[0-9]+)\" $" "\\ 1" SIMDJSON_VERSION
48- "${SIMDJSON_VERSION_DEFINITION} " )
49- if ("${SIMDJSON_VERSION} " STREQUAL "" )
50- set (SIMDJSON_VERSION "0.0.0" )
51- endif ()
52-
53- find_package_handle_standard_args (
54- SimdjsonAlt
55- REQUIRED_VARS SIMDJSON_INCLUDE_DIR SIMDJSON_LIBRARY
56- VERSION_VAR SIMDJSON_VERSION)
57-
58- if (SimdjsonAlt_FOUND)
59- if (WIN32 AND "${SIMDJSON_INCLUDE_DIR} " MATCHES "^/" )
60- # MSYS2
61- execute_process (COMMAND "cygpath" "--windows" "${SIMDJSON_INCLUDE_DIR} "
62- OUTPUT_VARIABLE SIMDJSON_INCLUDE_DIR
63- OUTPUT_STRIP_TRAILING_WHITESPACE )
64- endif ()
65- # Detect library type based on file extension
66- if ("${SIMDJSON_LIBRARY} " MATCHES "\\ .(so|dylib)(\\ .[0-9]+)*$" OR "${SIMDJSON_LIBRARY} "
67- MATCHES "\\ .dll$" )
68- add_library (simdjson::simdjson SHARED IMPORTED )
69- else ()
70- add_library (simdjson::simdjson STATIC IMPORTED )
71- endif ()
72- set_target_properties (simdjson::simdjson
73- PROPERTIES IMPORTED_LOCATION "${SIMDJSON_LIBRARY} "
74- INTERFACE_INCLUDE_DIRECTORIES
75- "${SIMDJSON_INCLUDE_DIR} " )
76- endif ()
77- return ()
78- endif ()
79-
8022# Manual search failed, try CMake config mode
8123set (find_package_args)
8224if (SimdjsonAlt_FIND_VERSION)
@@ -88,10 +30,4 @@ endif()
8830find_package (simdjson ${find_package_args} CONFIG )
8931if (simdjson_FOUND)
9032 set (SimdjsonAlt_FOUND TRUE )
91- if (NOT TARGET simdjson::simdjson)
92- # simdjson's CMake config should create this target, but create it if missing
93- if (TARGET simdjson)
94- add_library (simdjson::simdjson ALIAS simdjson )
95- endif ()
96- endif ()
9733endif ()
0 commit comments