CMake doesn't work with spaces when called from Gradle Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Android error: Failed to install *.apk on device *: timeoutGradle android build for different processor architecturesUsing armeabi and armeabi-v7a libraries with APK splitsError Gradle sync failed: Failed to find CMakeIt is possible to set cmake arguments per ABI in gradle?Android gradle+CMake - how to set number of build workersUnsupported method: BaseConfig.getApplicationIdSuffix()build cmake ExternalProject with gradleHow to use ffmpeg build libraries in Android studio?Error while executing process “cmake3.6.4111459bincmake.exe” with arguments

Significance of Cersei's obsession with elephants?

Amount of permutations on an NxNxN Rubik's Cube

What initially awakened the Balrog?

Crossing US/Canada Border for less than 24 hours

What do you call the main part of a joke?

How much damage would a cupful of neutron star matter do to the Earth?

Is it a good idea to use CNN to classify 1D signal?

How to tell that you are a giant?

How to write this math term? with cases it isn't working

Disembodied hand growing fangs

How would a mousetrap for use in space work?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

Did Deadpool rescue all of the X-Force?

Why is the AVR GCC compiler using a full `CALL` even though I have set the `-mshort-calls` flag?

What is "gratricide"?

Chinese Seal on silk painting - what does it mean?

What would you call this weird metallic apparatus that allows you to lift people?

How to install press fit bottom bracket into new frame

Is it fair for a professor to grade us on the possession of past papers?

Dating a Former Employee

A term for a woman complaining about things/begging in a cute/childish way

What does it mean that physics no longer uses mechanical models to describe phenomena?

How fail-safe is nr as stop bytes?

Most bit efficient text communication method?



CMake doesn't work with spaces when called from Gradle



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Android error: Failed to install *.apk on device *: timeoutGradle android build for different processor architecturesUsing armeabi and armeabi-v7a libraries with APK splitsError Gradle sync failed: Failed to find CMakeIt is possible to set cmake arguments per ABI in gradle?Android gradle+CMake - how to set number of build workersUnsupported method: BaseConfig.getApplicationIdSuffix()build cmake ExternalProject with gradleHow to use ffmpeg build libraries in Android studio?Error while executing process “cmake3.6.4111459bincmake.exe” with arguments



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I build my Android APKs from the command line on Windows using Gradle. It all works fine except when there is a space in the path name. In that case, Gradle doesn't seem to pass the path correctly to CMake, as can be seen in the console output.



In my build.gradle CMake is called like this:



externalNativeBuild 
cmake
path "src/main/cpp/CMakeLists.txt"




Now when I compile my project from C:testapktest all is fine. When I compile it from C:testapk test (note the space character!) it doesn't work any longer. The console output is this:



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildArm7Debug'.
> Build command failed.
Error while executing process C:UsersandreasAppDataLocalAndroidSdkcmake3.10.2.4988404bincmake.exe with arguments --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject
Unknown argument testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
<dir> = Project binary directory to be built.
--target <tgt> = Build <tgt> instead of default targets.
May only be specified once.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
--use-stderr = Ignored. Behavior is default in CMake >= 3.0.
-- = Pass remaining options to the native tool.


As you can see, CMake is incorrectly started from Gradle because it is started like this: cmake --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject but there should be double quotes around the --build argument so that it is parsed as a single argument and not as two separate arguments.



I think this is a bug but where should it be reported? Android NDK? Gradle? CMake?



Also, is there any workaround except not using paths with spaces?










share|improve this question






















  • Not every CMake project correctly process spaces in the source/binary directory. So it is better to not use such directories at all when work with CMake.

    – Tsyvarev
    Mar 8 at 23:48











  • This is supposed to be fixed in preview version here: https://developer.android.com/studio/preview/

    – Gerry
    Mar 9 at 4:14

















0















I build my Android APKs from the command line on Windows using Gradle. It all works fine except when there is a space in the path name. In that case, Gradle doesn't seem to pass the path correctly to CMake, as can be seen in the console output.



In my build.gradle CMake is called like this:



externalNativeBuild 
cmake
path "src/main/cpp/CMakeLists.txt"




Now when I compile my project from C:testapktest all is fine. When I compile it from C:testapk test (note the space character!) it doesn't work any longer. The console output is this:



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildArm7Debug'.
> Build command failed.
Error while executing process C:UsersandreasAppDataLocalAndroidSdkcmake3.10.2.4988404bincmake.exe with arguments --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject
Unknown argument testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
<dir> = Project binary directory to be built.
--target <tgt> = Build <tgt> instead of default targets.
May only be specified once.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
--use-stderr = Ignored. Behavior is default in CMake >= 3.0.
-- = Pass remaining options to the native tool.


As you can see, CMake is incorrectly started from Gradle because it is started like this: cmake --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject but there should be double quotes around the --build argument so that it is parsed as a single argument and not as two separate arguments.



I think this is a bug but where should it be reported? Android NDK? Gradle? CMake?



Also, is there any workaround except not using paths with spaces?










share|improve this question






















  • Not every CMake project correctly process spaces in the source/binary directory. So it is better to not use such directories at all when work with CMake.

    – Tsyvarev
    Mar 8 at 23:48











  • This is supposed to be fixed in preview version here: https://developer.android.com/studio/preview/

    – Gerry
    Mar 9 at 4:14













0












0








0








I build my Android APKs from the command line on Windows using Gradle. It all works fine except when there is a space in the path name. In that case, Gradle doesn't seem to pass the path correctly to CMake, as can be seen in the console output.



In my build.gradle CMake is called like this:



externalNativeBuild 
cmake
path "src/main/cpp/CMakeLists.txt"




Now when I compile my project from C:testapktest all is fine. When I compile it from C:testapk test (note the space character!) it doesn't work any longer. The console output is this:



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildArm7Debug'.
> Build command failed.
Error while executing process C:UsersandreasAppDataLocalAndroidSdkcmake3.10.2.4988404bincmake.exe with arguments --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject
Unknown argument testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
<dir> = Project binary directory to be built.
--target <tgt> = Build <tgt> instead of default targets.
May only be specified once.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
--use-stderr = Ignored. Behavior is default in CMake >= 3.0.
-- = Pass remaining options to the native tool.


As you can see, CMake is incorrectly started from Gradle because it is started like this: cmake --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject but there should be double quotes around the --build argument so that it is parsed as a single argument and not as two separate arguments.



I think this is a bug but where should it be reported? Android NDK? Gradle? CMake?



Also, is there any workaround except not using paths with spaces?










share|improve this question














I build my Android APKs from the command line on Windows using Gradle. It all works fine except when there is a space in the path name. In that case, Gradle doesn't seem to pass the path correctly to CMake, as can be seen in the console output.



In my build.gradle CMake is called like this:



externalNativeBuild 
cmake
path "src/main/cpp/CMakeLists.txt"




Now when I compile my project from C:testapktest all is fine. When I compile it from C:testapk test (note the space character!) it doesn't work any longer. The console output is this:



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:externalNativeBuildArm7Debug'.
> Build command failed.
Error while executing process C:UsersandreasAppDataLocalAndroidSdkcmake3.10.2.4988404bincmake.exe with arguments --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject
Unknown argument testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a
Usage: cmake --build <dir> [options] [-- [native-options]]
Options:
<dir> = Project binary directory to be built.
--target <tgt> = Build <tgt> instead of default targets.
May only be specified once.
--config <cfg> = For multi-configuration tools, choose <cfg>.
--clean-first = Build target 'clean' first, then build.
(To clean only, use --target 'clean'.)
--use-stderr = Ignored. Behavior is default in CMake >= 3.0.
-- = Pass remaining options to the native tool.


As you can see, CMake is incorrectly started from Gradle because it is started like this: cmake --build C:testapk testapp.externalNativeBuildcmakearm7Debugarmeabi-v7a --target myproject but there should be double quotes around the --build argument so that it is parsed as a single argument and not as two separate arguments.



I think this is a bug but where should it be reported? Android NDK? Gradle? CMake?



Also, is there any workaround except not using paths with spaces?







android gradle cmake android-ndk






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 20:33









AndreasAndreas

2,44922749




2,44922749












  • Not every CMake project correctly process spaces in the source/binary directory. So it is better to not use such directories at all when work with CMake.

    – Tsyvarev
    Mar 8 at 23:48











  • This is supposed to be fixed in preview version here: https://developer.android.com/studio/preview/

    – Gerry
    Mar 9 at 4:14

















  • Not every CMake project correctly process spaces in the source/binary directory. So it is better to not use such directories at all when work with CMake.

    – Tsyvarev
    Mar 8 at 23:48











  • This is supposed to be fixed in preview version here: https://developer.android.com/studio/preview/

    – Gerry
    Mar 9 at 4:14
















Not every CMake project correctly process spaces in the source/binary directory. So it is better to not use such directories at all when work with CMake.

– Tsyvarev
Mar 8 at 23:48





Not every CMake project correctly process spaces in the source/binary directory. So it is better to not use such directories at all when work with CMake.

– Tsyvarev
Mar 8 at 23:48













This is supposed to be fixed in preview version here: https://developer.android.com/studio/preview/

– Gerry
Mar 9 at 4:14





This is supposed to be fixed in preview version here: https://developer.android.com/studio/preview/

– Gerry
Mar 9 at 4:14












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070615%2fcmake-doesnt-work-with-spaces-when-called-from-gradle%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55070615%2fcmake-doesnt-work-with-spaces-when-called-from-gradle%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved