Page 1 of 1

question about DGMConfig.cmake

Posted: Fri Nov 16, 2018, 01:03
by tigertaco
Hello,

I'm trying to create my own cmake project whuch uses DGM with suggested CMakeLists.txt however when I do cmake it complains:

***************************
cmake ..
CMake Error at /Users/fy378ee/DGM-master/build/DGMConfig.cmake:12 (include):
include could not find load file:

/Users/fy378ee/DGM-master/build/lib/DGMTargets.cmake
Call Stack (most recent call first):
CMakeLists.txt:8 (find_package)

-- Configuring incomplete, errors occurred!

****************************
And, indeed, there is no DGMTargets.cmake in build/lib folder.

Please help!

Re: question about DGMConfig.cmake

Posted: Fri Nov 16, 2018, 01:20
by Creator
Hello!
File DGMTargets.cmake should appear in the <install_dirrectory>/lib. Probably the path
/Users/fy378ee/DGM-master/build/
is not your install directory, but the build directory.
Please run make install after building the DGM library (as describied here).

P.S.
You can specify the install directory in Cmake using the flag -DCMAKE_INSTALL_PREFIX.

Re: question about DGMConfig.cmake

Posted: Fri Nov 16, 2018, 22:06
by tigertaco
Hi, thank you for a fast reply, really appreciated!

Now "cmake" in my project went through fine.

But "make" throws 8 errors, this is one of them:

******************

/Users/fy378ee/crfmodel/source/main.cpp:35:48: error: allocating an object of abstract class type 'DirectGraphicalModels::CGraph'
CGraph * graph = new CGraph(nStates);

My main.cpp is just one of your tutorials (Demo Viz code), nothing more. It looks like it doesn't see Graph.cpp file and thinks Graph is an abstract class.

Let me know if you need any more info to help. Im on mac, compiler is AppleClang 9.0.

Thank you!

Re: question about DGMConfig.cmake

Posted: Fri Nov 16, 2018, 23:28
by Creator
Hello!
I think the problem is following: probably you took the latest version of DGM from GitHub, which is 1.7.0.alpha but used the demo code from web-tutorials, which rely to the latest release version 1.6.0.
There are 2 ways to solve this problem:
  1. Use the demo, which comes with the library. It may be found in the DGM/demos folder. Or copy it from master branch on GitHub: https://github.com/Project-10/DGM/blob/ ... zation.cpp (CGraph class is substituted with CGraphPairwise)
  2. OR use the latest release of the library, which may be downloaded from here: https://github.com/Project-10/DGM/releases

Re: question about DGMConfig.cmake

Posted: Sat Nov 17, 2018, 00:15
by tigertaco
Works! (tried your option 1). Thank you!

One last thing (going back to my original problem with cmake):

Currently, everything works but only after I replaced the line
include(${DGM_CMAKE_DIR}/lib/DGMTargets.cmake)
with
include(${DGM_CMAKE_DIR}/install/lib/DGMTargets.cmake) (adding install to the path)

in the file /Users/fy378ee/DGM-master/build/DGMConfig.cmake

Without this change cmake doesn't work. Not sure what is going on.

Re: question about DGMConfig.cmake

Posted: Sat Nov 17, 2018, 13:57
by Creator
Hello!
This is very strange because your project should not know about the files which lie outside the DGM install directory. Thats it, if
/Users/fy378ee/DGM-master/build/ - your build directory, and
/Users/fy378ee/DGM-master/build/install/ - your install directory
your new project, based on the library should use only files in /Users/fy378ee/DGM-master/build/install/ and file /Users/fy378ee/DGM-master/build/DGMConfig.cmake should not be in play.
Please check that this line in your CMakeLists.txt file points exactly to the install directory:

Code: Select all

find_package(DGM 1.6 REQUIRED PATHS "/Users/fy378ee/DGM-master/build/install")