Shared object with CMake

Hi all,
I am still fighting with the transition from normal Makefile to CMake.

In order to clarify my questions I prepared two examples one using the conventional Makefile (used so far and working) and one showing my attemps to generate the same program with CMake.

The example inludes a shared library libMyUtilities.so with a class my_utilities and a function myReturn(Float_t) which returns the input Float_t. In addition there is a small main in the roottest directory which is calling myReturn.

Here the Makefile example:
rootDict_make.tar.gz (1.92 KB)
in order to make it work I added to my .bashrc

cd /home/christian/rootDict_make
source setup.sh  
# setup.sh set a few variables and adds the path with libMyUtilities.so to LD_LIBRARY_PATH

to use libMyUtilities.so from root I also added

gSystem.Load("libMyUtilities.so");

to my rootlogon file.
In the end I can use libMyUtilities.so with my compiled code and from within root.

Now I am trying to achive the same result with CMake
Here the CMake example:
rootDict_cmake.tar.gz (12.2 KB)

mkdir build
cd build
cmake ..

I get the message

-- Configuring done
CMake Error at my_util/CMakeLists.txt:31 (ADD_LIBRARY):
  Cannot find source file:

    /home/christian/rootDict_cmake/build/my_util/mylib_Dict.cxx

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx


-- Build files have been written to: /home/christian/rootDict_cmake/build

The file mylib_Dict.cxx can not be found as it should be greated by the function ROOT_GENERATE_DICTIONARY

I don’t see how to fix this issue.
Looking forward to receive some advice.

Thanks for the help.
Christian