set( PROJ_NAME Test01 ) file( GLOB ${PROJ_NAME}_SRC *.h *.cpp ) add_executable( ${PROJ_NAME} ${${PROJ_NAME}_SRC} )
On Thu, Jan 22, 2015 at 1:05 AM, Eric Noulard <eric.noul...@gmail.com> wrote: > > > 2015-01-22 3:41 GMT+01:00 Joshua Robinson <shooki.robin...@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 > > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > 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 > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: 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 Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake