SUSoftCMakeCommon
July 13, 2023 ยท View on GitHub
This repository is supposed to hold the shared CMake configuration between the different SU softwares.
Features
- It sets the different compile options for the compiler
- It copies at build time the required DLLs (and add them in the installer)
Configuration
This repository contains a ext_libs.txt file. The paths defined should be present on your OS. The variables are:
EXT_LIBS_TXT_PATH: path to yourext_libs.txtpath that should defineEXT_LIB_PATHEXT_LIB_PATH: path to your dev environment (default is"C:/susoft/ext")EIGEN_INCLUDE_PATH: The path to Eigen folderQT_ROOT_PATH: The path to Qt installation. You should have among othersbinandlibfolders thereREFRAME_LIBRARY_DIR: The path to Reframe folderREFRAME2016_LIBRARY_DIR: The path to Reframe (v2016) folderTUT_INCLUDE_PATH: The path to Tut folderOPENSSL_ROOT_DIR: The path to OpenSSL folder
Usage
You can configure what you want to initialize thanks to these variables:
- if
create_docis TRUE, create Doxygen documentation- Note that you'll need to set the variable
DOXYGEN_CONF_PATHas a relative path to theDoxyfile.in. e.g.option(DOXYGEN_CONF_PATH "LGC")
- Note that you'll need to set the variable
- if
USE_QTis TRUE, configure QT.- You need to set
QT_ROOT_PATHto your root installation - You can tell the Qt wanted modules as a list in
QT_WANTED_MODULES(default is Core)
- You need to set
- if
USE_OPENSSLis TRUE, provide OpenSSL DLLs for installers.- You need to set
OPENSSL_ROOT_DIRto your root installation
- You need to set
- if
cpack_build, build binary and source package installers. - if
enable_console, Enable the console
Moreover, you can provide a flag during CMake project generation to override the default EXT_LIBS_TXT_PATH if you don't want to use the default path provided by the SUSoftCMakeCommon submodule.
In order to do that, provide a path via flag:-DEXT_LIBS_TXT_PATH="C:/susoft/SUSoftCMakeCommon/ext_libs.txt". This flag has to be added prior to the CMake source dir.
Functions
You also have the following functions available to copy files at compile time in the created executable folder:
deployqt
Run the Qt deployment tool to copy DLLs and translation files
- param
targetthe target when we want to copy (like the executable name) - optional parameter: the path to the output dir where the DLL will be copied default is the target binary dir
- optional paramter: the path to the executable we want to run the Qt deployment tool on default is the executable generated by the given target. Note: the previous optional parameter must be set to set this one
function(deployqt target)
post_build_copy_dlls
Copy files int the build directory at build time if files don't already exist.
- param
targetthe target when we want to copy (like the executable name) - param
debug_files(list) files that should go into the debug folder - param
release_files(list) files that should go into the release folder (can be the same asdebug_files) - param
subdiran optionnal subdir where to write the files
Note: debug_files and release_files must have the same length
Note: this function should be called after the definition of the executable
function(post_build_copy_dlls debug_files release_files subdir)
set_vs_default_startup_project
Set the given project as the default startup project in MSVC++.
- param
project_namethe project that should be set as the default startup project
Note: this function should be called after the definition of the executable
function(set_vs_default_startup_project project_name)
create_default_installer
Create an installer package.
The installer contains the minimum required files:
- the executable
- the VC redist
- if
USE_QT, runswindeployqt - if
CREATE_DOC, adds the doc - if
USE_OPENSSL, copies OpenSSL DLLs
Note: You can add extra files to the installer thanks to the function
installer_copy_files (see below)
Note: this function should be called after the definition of the executable
function(create_default_installer)
installer_copy_files
When creating the installer, this function can be called to add files in the installer.
- param
filesa list of files to add - param
destinationthe destination in the installation folder
Note: this function should be called after the definition of the executable
and preferably after the call to create_default_installer
function(installer_copy_files files destination)