BassClef66
BassClef66

Reputation: 33

Running external program with multiple arguments in CMAKE

Good Day...

I'm writing an app that requires cross compilation and runs and external command to convert images.

In linux and osx, the following works well:

EXECUTE_PROCESS( COMMAND convert ${PNG_FILE} -resize ${size}x${size} ${XPM_FILE})

However when I try to run it under windows, I receive the error "Invalid Paramer - -resize"

Any suggestions would be most appreciated...

Rob

Upvotes: 1

Views: 420

Answers (1)

Florian
Florian

Reputation: 43048

Since execute_command() does use the OS shell you/CMake probably found Window's own convert.exe:

 > help convert 
 Converts a FAT volume to NTFS. 
 CONVERT volume /FS:NTFS [/V] [/CvtArea:filename] [/NoSecurity] [/X]

So give a full path to ImageMagick's convert.exe program. CMake can help you finding it:

include(FindImageMagick) 
find_package(ImageMagick COMPONENTS convert REQUIRED)
EXECUTE_PROCESS( COMMAND ${ImageMagick_EXECUTABLE_DIR}/convert ${PNG_FILE} -resize ${size}x${size} ${XPM_FILE})

Upvotes: 1

Related Questions