@@ -17,6 +17,11 @@ set(TDMIME_AUTO
1717add_custom_target (tdmime_auto DEPENDS ${TDMIME_SOURCE} )
1818
1919if (NOT CMAKE_CROSSCOMPILING )
20+ find_program (GPERF_EXECUTABLE gperf )
21+ if (NOT GPERF_EXECUTABLE)
22+ message (FATAL_ERROR "Could NOT find gperf. Path to gperf needs to be specified manually, i.e. 'cmake -DGPERF_EXECUTABLE:FILEPATH=\" <path to gperf executable>\" .')" )
23+ endif ()
24+
2025 set (GPERF_FILES
2126 ${CMAKE_CURRENT_SOURCE_DIR } /auto/mime_type_to_extension.gperf
2227 ${CMAKE_CURRENT_SOURCE_DIR } /auto/extension_to_mime_type.gperf
@@ -34,9 +39,9 @@ if (NOT CMAKE_CROSSCOMPILING)
3439 )
3540
3641 if (WIN32 )
37- set (MIME_TYPE_TO_EXTENSION_CMD powershell -ExecutionPolicy ByPass \ " & gperf - m100 --output-file=auto/mime_type_to_extension.cpp auto/mime_type_to_extension.gperf\" )
42+ set (MIME_TYPE_TO_EXTENSION_CMD ${GPERF_EXECUTABLE} - m100 --output-file=auto/mime_type_to_extension.cpp auto/mime_type_to_extension.gperf)
3843 else ()
39- set(MIME_TYPE_TO_EXTENSION_CMD gperf -m100 auto/mime_type_to_extension.gperf | grep -v __gnu_inline__ > auto/mime_type_to_extension.cpp)
44+ set (MIME_TYPE_TO_EXTENSION_CMD ${GPERF_EXECUTABLE} -m100 auto/mime_type_to_extension.gperf | grep -v __gnu_inline__ > auto/mime_type_to_extension.cpp)
4045 endif ()
4146 add_custom_command (
4247 OUTPUT ${CMAKE_CURRENT_SOURCE_DIR } /auto/mime_type_to_extension.cpp
@@ -46,9 +51,9 @@ if (NOT CMAKE_CROSSCOMPILING)
4651 )
4752
4853 if (WIN32 )
49- set(EXTENSION_TO_MIME_TYPE_CMD powershell -ExecutionPolicy ByPass \" & gperf - m100 --output-file=auto/extension_to_mime_type.cpp auto/extension_to_mime_type.gperf\" )
54+ set (EXTENSION_TO_MIME_TYPE_CMD ${GPERF_EXECUTABLE} - m100 --output-file=auto/extension_to_mime_type.cpp auto/extension_to_mime_type.gperf)
5055 else ()
51- set(EXTENSION_TO_MIME_TYPE_CMD gperf -m100 auto/extension_to_mime_type.gperf | grep -v __gnu_inline__ > auto/extension_to_mime_type.cpp)
56+ set (EXTENSION_TO_MIME_TYPE_CMD ${GPERF_EXECUTABLE} -m100 auto/extension_to_mime_type.gperf | grep -v __gnu_inline__ > auto/extension_to_mime_type.cpp)
5257 endif ()
5358 add_custom_command (
5459 OUTPUT ${CMAKE_CURRENT_SOURCE_DIR } /auto/extension_to_mime_type.cpp
0 commit comments