Android Studio, CMake. How to print debug message in compile time?
I’m using Android Studio 2.3 beta 3. I put
message(AUTHOR_WARNING "Hello CMake, hello Android") In my CMakeLists.txt
But I saw this message only few times when rebuilding project in Android Studio. In most cases there’s no
"Hello CMake, hello Android" string in Gradle Console after build finishes. I’ve tried resync gradle and clean/rebuild project, still no expected output.
I have some problems with my build (I think it’s incorrect paths) so my goal – to print CMake variables in compile time to better understand what is actually going on.
CMake messages are only at generation time (when
CMake is used to generate your project / Makefile).
One way to get
CMake to generate is to go to retrieve the build folder and the
CMakeCache.txt file in it, and then:
- Retrieve the path to your cmake executable, by reading the
CMakeCache.txtfile and checking the value of the
- Open a command prompt in
Note: The build folder should have a
CMakeCache.txt file. The above will not work unless it does.
Answered By – drescherjm