2014-10-25 14:11 GMT+02:00 Zé <[email protected]>:

> I've defined a small function that helps add unit test definitions in a
> concise manner.  I would like to store this function on a dedicated file to
> decluter the CMakeLists.txt file where that function is currently defined.
> Can anyone tell me what's the best way to store custom function definitions
> within a project tree?
>

I don't know whether if there is "THE" best way but my habit is the
following:

put all custom cmake scripts into a project subdir call
<PROJECT_ROOT>/cmake/ or sometimes <PROJECT_ROOT>/devel-scripts because I
put there other development oriented scripts written in
CMake, shell, python etc...

Then in my main CMakeLists.txt I add the dir to the CMake module path:

# Add project source dir as module path
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/devel-scripts)

then when I need the macros defined in say "MyTestTools.cmake" I do:

include(MyTestTools.cmake)


I don't really know if it's the best way, but it works ok and makes it easy
to add more custom macro files when needed.


-- 
Erk
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

Reply via email to