I am not very familiar with cmake. I need to add libaray to link with. Most of file say generated to not edit. I am getting the error when linkiing:
/usr/bin/ld: CMakeFiles/Tooling.dir/Tooling.cpp.o: undefined reference to symbol 'HPDF_Free'
/usr/lib64/libhpdf-2.3.0.so: error adding symbols: DSO missing from command line
In which file do I add libhpdf-2.3.0.so so it will link with it, that will not over written?
Thanks,
Ron
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It depends what the library is, and I'm afraid that cmake does make something of a meal of it. But we have made and included libraries as part of DesignerWt and you can use what we did as a template. Cmake generates files that instruct make how to build the project, so you need to tell cmake to put in references to libraries and their include files.
Case 1: The library is not part of your source code, but is already installed on your development machine and will be available in the deployment machine. In each case, you could set lists to have the one value that exists in your machine, and later extend the lists to allow for other architectures.
You need to insert two commands in DesignerWt/CMakeLists.txt file, which is the master configuration file for the build. I suggest that you add them around line 100, certainly after the line that starts "set(CMAKE_MODULE_PATH......".
You need a "include_directories" command, which adds directories to the include path, and a "set(LIBS ${LIBS} ..." command which appends libraries to the libraries list. You need to specify the full path of the include directory, and remove the initial "lib" and the version number and suffix from the library name. So you need something like:
if the library has an include file in its own directory, like /usr/include/hpdf/libhpdf.h.
CASE 2: the library is part of your source code and you want other parts of your code to call it as an so.
For this, you must ensure that the library code is called for building before the code that calls it. In DesignerWt/CMakeLists.txt around line 737, there are a series of "add_subdirectory" calls, which instruct cmake to look for the file in that subdirectory, also called CMakeList.txt, and run it. You can see that it calls tinyxml first because the other subdirectories use it. To do this you would need to write your own CMakeLists.txt file for your library subdirectory.
I hope that this helps,
Eoin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I am not very familiar with cmake. I need to add libaray to link with. Most of file say generated to not edit. I am getting the error when linkiing:
/usr/bin/ld: CMakeFiles/Tooling.dir/Tooling.cpp.o: undefined reference to symbol 'HPDF_Free'
/usr/lib64/libhpdf-2.3.0.so: error adding symbols: DSO missing from command line
In which file do I add libhpdf-2.3.0.so so it will link with it, that will not over written?
Thanks,
Ron
Hi Ron
It depends what the library is, and I'm afraid that cmake does make something of a meal of it. But we have made and included libraries as part of DesignerWt and you can use what we did as a template. Cmake generates files that instruct make how to build the project, so you need to tell cmake to put in references to libraries and their include files.
Case 1: The library is not part of your source code, but is already installed on your development machine and will be available in the deployment machine. In each case, you could set lists to have the one value that exists in your machine, and later extend the lists to allow for other architectures.
You need to insert two commands in DesignerWt/CMakeLists.txt file, which is the master configuration file for the build. I suggest that you add them around line 100, certainly after the line that starts "set(CMAKE_MODULE_PATH......".
You need a "include_directories" command, which adds directories to the include path, and a "set(LIBS ${LIBS} ..." command which appends libraries to the libraries list. You need to specify the full path of the include directory, and remove the initial "lib" and the version number and suffix from the library name. So you need something like:
if the library has an include file in its own directory, like /usr/include/hpdf/libhpdf.h.
CASE 2: the library is part of your source code and you want other parts of your code to call it as an so.
For this, you must ensure that the library code is called for building before the code that calls it. In DesignerWt/CMakeLists.txt around line 737, there are a series of "add_subdirectory" calls, which instruct cmake to look for the file in that subdirectory, also called CMakeList.txt, and run it. You can see that it calls tinyxml first because the other subdirectories use it. To do this you would need to write your own CMakeLists.txt file for your library subdirectory.
I hope that this helps,
Eoin
Thanks you!!!
Ron