Discussion:
[CMake] Does CMake support the --question option for GNU Makefiles?
Alex Tzonkov
2018-11-27 16:51:31 UTC
Permalink
We are using cmake for our project and recently discovered that the
generated Makefiles do not seem to work correctly with the '--question' or
'-q' option. The return code is always '1' even if there are no changes
which would require rebuilding/recompiling anything. I am not sure if this
is an issue with our CmakeLists.txt files or *.cmake files or a general
issue with cmake. Any pointers would be greatly appreciated.

I apologize if this is an answered question, I tried really hard to search
the archives, but searching for "--question" is futile, as the searches
return pretty much every question.
frodak
2018-11-27 20:06:13 UTC
Permalink
I think this is just a misunderstanding and not related to CMake.

Make --question mode always returns a 1 if the target is PHONY because
these targets are always out of date.
The Makefiles generated by CMake use a top level PHONY target (and other
PHONY targets as well)

***@i7-lab:~/temp/bldlibvnc$ make -q
CMakeFiles/vncserver.dir/libvncserver/zrleoutstream.c.o
***@i7-lab:~/temp/bldlibvnc$ echo $?
0
***@i7-lab:~/temp/bldlibvnc$ make -q
***@i7-lab:~/temp/bldlibvnc$ echo $?
1

OR

***@i7-lab:~/temp/bldlibvnc$ make -q vncclient
***@i7-lab:~/temp/bldlibvnc$ echo $?
1
***@i7-lab:~/temp/bldlibvnc$ make -q libvncclient.so
***@i7-lab:~/temp/bldlibvnc$ echo $?
0

So you'll need to discern the actual target you want to check.

Best regards...
Post by Alex Tzonkov
We are using cmake for our project and recently discovered that the
generated Makefiles do not seem to work correctly with the '--question' or
'-q' option. The return code is always '1' even if there are no changes
which would require rebuilding/recompiling anything. I am not sure if this
is an issue with our CmakeLists.txt files or *.cmake files or a general
issue with cmake. Any pointers would be greatly appreciated.
I apologize if this is an answered question, I tried really hard to search
the archives, but searching for "--question" is futile, as the searches
return pretty much every question.
--
Powered by www.kitware.com
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
https://cmake.org/mailman/listinfo/cmake
Alex Tzonkov
2018-11-28 03:12:15 UTC
Permalink
Thanks for the quick response it makes more sense now. Looking at our CMake
files, I see now that all our targets are indeed PHONY, because we use
*add_custom_target
*to create those targets. So no matter what they are always considered out
of date. For now I'll have to assume that whoever wrote the CMake files had
a good reason for doing that. Is that considered a recommend way to set up
a project, or perhaps each and every project is unique so it does not make
sense to even have a recommendation?
Post by frodak
I think this is just a misunderstanding and not related to CMake.
Make --question mode always returns a 1 if the target is PHONY because
these targets are always out of date.
The Makefiles generated by CMake use a top level PHONY target (and other
PHONY targets as well)
CMakeFiles/vncserver.dir/libvncserver/zrleoutstream.c.o
0
1
OR
1
0
So you'll need to discern the actual target you want to check.
Best regards...
Post by Alex Tzonkov
We are using cmake for our project and recently discovered that the
generated Makefiles do not seem to work correctly with the '--question' or
'-q' option. The return code is always '1' even if there are no changes
which would require rebuilding/recompiling anything. I am not sure if this
is an issue with our CmakeLists.txt files or *.cmake files or a general
issue with cmake. Any pointers would be greatly appreciated.
I apologize if this is an answered question, I tried really hard to
search the archives, but searching for "--question" is futile, as the
searches return pretty much every question.
--
Powered by www.kitware.com
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
https://cmake.org/mailman/listinfo/cmake
Loading...