Next: 09 - GUI Module, Previous: 07 - Storage Module
Copy an existing CMakeLists.txt file from the Generator module:
evaf/src/apps/PswGen/Storage $ cp ../Generator/CMakeLists.txt .
We only need to modify the TARGET variable and set QT_USE_QTSQL to TRUE:
# Name of the target set(TARGET PswStorage) # Qt modules set(QT_USE_QTSQL TRUE)
Here is the final CMakeLists.txt file:
# src/apps/PswGen/Storage/CMakeLists.txt # Name of the target set(TARGET PswStorage) # Qt modules set(QT_USE_QTSQL TRUE) set(QT_DONT_USE_QTGUI TRUE) include(${QT_USE_FILE}) # Include directories include_directories(${eVaf_INCLUDE}) # Required eVaf libraries set(eVaf_LIBRARIES CommonLib PluginsLib) # Source files set(SRCS module.cpp ) # Header files for the Qt meta-object compiler set(MOC_HDRS module.h ) # Version info resource file for Windows builds if(WIN32) set(SRCS ${SRCS} version.rc) endif(WIN32) # Run the Qt meta-object compiler qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS}) # Compile the module add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS}) # Link the module target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
Open the CMakeLists.txt file in the parent directory and add the command to include the Storage sub-directory:
# src/apps/PswGen/CMakeLists.txt # ... add_subdirectory(Storage)
Go to the previously made build directory and build the module:
evaf $cd build
evaf/build $make PswStorage
Check the bin directory, which should now contain a new library:
evaf/build $ ls bin
libCommonLib.so* libPluginsLib.so* libPswGen.so* libPswStorage.so*
evaf/build $
In the next section 09 - GUI Module we write the Graphical User Interface Module.