Tyler Roscoe schrieb:
> On Wed, Feb 10, 2010 at 09:08:50PM +0100, Olaf Peter wrote:
>> How can I add an extra lint/syntax check target for my executable, like:
>>
>> check-syntax:
>>      c++ -o /dev/null ${CXX_FLAGS} ${CXX_DEFINES} -S ${MY_PROJECT_SOURCES}
>> .PHONY: check-syntax
> 
> You'll want to look at add_custom_command() and maybe
> add_custom_target(). The FAQ has some examples you can look to as well.

I did try it and it doesn't work:

---8<--- CMakeList.txt
add_custom_target (syntax-check
  COMMAND ${CXX} CHECK_SRC)

---8<---- build/src/Makefile
....
# Convenience name for target.
src/CMakeFiles/syntax-check.dir/rule:
        cd /home/olaf/Projects/programming/cpp/build && $(MAKE) -f
CMakeFiles/Makefile2 src/CMakeFiles/syntax-check.dir/rule
.PHONY : src/CMakeFiles/syntax-check.dir/rule

# Convenience name for target.
syntax-check: src/CMakeFiles/syntax-check.dir/rule
.PHONY : syntax-check

# fast build rule for target.
syntax-check/fast:
        cd /home/olaf/Projects/programming/cpp/build && $(MAKE) -f
src/CMakeFiles/syntax-check.dir/build.make
src/CMakeFiles/syntax-check.dir/build
.PHONY : syntax-check/fast


It shall be equivilanet to a 'lint' target.

Thanks,
Olaf
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to