[CMake] Circular dependencies because of file names?

Michael Hertling mhertling at online.de
Thu Nov 17 07:51:29 EST 2011


On 11/16/2011 06:36 PM, Jookia wrote:
> I've actually used that workaround, but it seems dirty as it shows up in 
> IDE targets like Visual Studio or other IDEs or makefiles. In fact, I 
> kind of like the 'generating ..../docs' part of the makefile.
> 
> Would it just be smarter to rename the target to 'documentation'?

Of course, that's also possible, but then, the documentation target and
the documentation directory would not be named the same. Alternatively,
you might leave out the WORKING_DIRECTORY clause, add another COMMAND
"cmake -E make_directory" to the target and use "cmake -E chdir":

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(DOCS NONE)
SET(CMAKE_VERBOSE_MAKEFILE ON)
ADD_CUSTOM_TARGET(docs
    COMMAND ${CMAKE_COMMAND} -E
        make_directory ${CMAKE_BINARY_DIR}/docs
    COMMAND ${CMAKE_COMMAND} -E
        chdir ${CMAKE_BINARY_DIR}/docs pwd)

Presumably, the directory's additional creations carries no weight.

Regards,

Michael


More information about the CMake mailing list