[CMake] add_executable question

Eric Noulard eric.noulard at gmail.com
Thu Jan 22 02:05:06 EST 2015


2015-01-22 3:41 GMT+01:00 Joshua Robinson <shooki.robinson at gmail.com>:

>
> Greetings,
>
> Can I add a variable, was set before, to add_executable ?
>

I guess yes. However if "PROJ_NAME" value was used in

project(Test01 C CXX)

then there may be a conflict between "project name" and a "target name"

>
> set(PROJ_NAME Test01)
> ,,,
> file( GLOB ${PROJ_NAME}_SRC "*.h" "*.cpp" )
>

Globbing for source is a bad practice (unless it is for generated files)
which make it difficult to properly track dependencies.
You may search the ML archive for discussion about that.


> add_executable( ${PROJ_NAME}  ${PROJ_NAME}_SRC)
> ...
>
> error in add_executable(..)
>

what kind of error?
Please give us more information like the exact error spitted out by cmake.


-- 
Eric
L'élection n'est pas la démocratie -- http://www.le-message.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150122/a44b7f58/attachment.html>


More information about the CMake mailing list