aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorVasyl Gello <vasek.gello@gmail.com>2021-10-30 16:27:38 +0300
committerVasyl Gello <vasek.gello@gmail.com>2021-11-03 23:26:39 +0000
commit2d005ef07c326562ef4e5af7e87865282b1bddd0 (patch)
tree676d551f4238cda26097686b95780b41d9b0deb7 /cmake
parent1be4c3df4e01e1d32a94f3d5ab661c1a17be173b (diff)
Fix "*-EXECUTABLE_NOTFOUND" if absolute path to file specified
Fixes broken handling of WITH_* CMake configuration options: * find_program expects directory in PATHS and HINTS while WITH_* option is an absolute path to file. * PATHS in find_program is the last resort option which declares hardcoded guesses utilized after all cached paths, then directories specified by HINTS. This commit splits the full pathname to directory and filename then "searches" the filename in the directory, confirming file exists there and is executable. Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindJsonSchemaBuilder.cmake6
-rw-r--r--cmake/modules/FindTexturePacker.cmake6
2 files changed, 8 insertions, 4 deletions
diff --git a/cmake/modules/FindJsonSchemaBuilder.cmake b/cmake/modules/FindJsonSchemaBuilder.cmake
index 1e9afdfba6..06957c6a07 100644
--- a/cmake/modules/FindJsonSchemaBuilder.cmake
+++ b/cmake/modules/FindJsonSchemaBuilder.cmake
@@ -31,11 +31,13 @@ if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder)
else()
if(WITH_JSONSCHEMABUILDER)
get_filename_component(_jsbpath ${WITH_JSONSCHEMABUILDER} ABSOLUTE)
+ get_filename_component(_jsbpath ${_jsbpath} DIRECTORY)
find_program(JSONSCHEMABUILDER_EXECUTABLE NAMES "${APP_NAME_LC}-JsonSchemaBuilder" JsonSchemaBuilder
- PATHS ${_jsbpath})
+ HINTS ${_jsbpath})
include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(JsonSchemaBuilder DEFAULT_MSG JSONSCHEMABUILDER_EXECUTABLE)
+ find_package_handle_standard_args(JsonSchemaBuilder "Could not find '${APP_NAME_LC}-JsonSchemaBuilder' or 'JsonSchemaBuilder' executable in ${_jsbpath} supplied by -DWITH_JSONSCHEMABUILDER. Make sure the executable file name matches these names!"
+ JSONSCHEMABUILDER_EXECUTABLE)
if(JSONSCHEMABUILDER_FOUND)
add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL)
set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES
diff --git a/cmake/modules/FindTexturePacker.cmake b/cmake/modules/FindTexturePacker.cmake
index 20d2ef7ea0..5284d72887 100644
--- a/cmake/modules/FindTexturePacker.cmake
+++ b/cmake/modules/FindTexturePacker.cmake
@@ -31,11 +31,13 @@ if(NOT TARGET TexturePacker::TexturePacker)
else()
if(WITH_TEXTUREPACKER)
get_filename_component(_tppath ${WITH_TEXTUREPACKER} ABSOLUTE)
+ get_filename_component(_tppath ${_tppath} DIRECTORY)
find_program(TEXTUREPACKER_EXECUTABLE NAMES "${APP_NAME_LC}-TexturePacker" TexturePacker
- PATHS ${_tppath})
+ HINTS ${_tppath})
include(FindPackageHandleStandardArgs)
- find_package_handle_standard_args(TexturePacker DEFAULT_MSG TEXTUREPACKER_EXECUTABLE)
+ find_package_handle_standard_args(TexturePacker "Could not find '${APP_NAME_LC}-TexturePacker' or 'TexturePacker' executable in ${_tppath} supplied by -DWITH_TEXTUREPACKER. Make sure the executable file name matches these names!"
+ TEXTUREPACKER_EXECUTABLE)
if(TEXTUREPACKER_FOUND)
add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
set_target_properties(TexturePacker::TexturePacker PROPERTIES