# SoftPLC 5.x C/C++ Toolkit CMakeList.txt template for building a TLM. # Lines after a # are a comment. # Do not re-order these lines needlessly. However you may delete comments that you think # might be noisy. # This line is required by CMake cmake_minimum_required(VERSION 3.1 FATAL_ERROR) # Set the name of your TLM by editing 'mytlm' to your lower-case name set( TLM mytlm ) project( ${TLM} ) # The following lines contain required settings for the TLM to be # packaged into a *.deb file. Build the package using $ make package, see manual. # CPACK_PACKAGE_VERSION_MAJOR/MINOR/PATCH are used to create a version number # CPACK_PACKAGE_CONTACT is the maintainer of the TLM (name, email) # CPACK_PACKAGE_DESCRIPTION_SUMMARY is a short description of the TLM set( CPACK_PACKAGE_VERSION_MAJOR 1 ) set( CPACK_PACKAGE_VERSION_MINOR 0 ) set( CPACK_PACKAGE_VERSION_PATCH 0 ) set( CPACK_PACKAGE_CONTACT "Firstname Lastname " ) set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sample TLM" ) # This includes the TLM module provided with the SoftPLC Toolkit which provides # a predefined set of includes, build flags, plus optimizations for Debug and # Release builds. Mandatory for any TLM. include(tlm) # Set a variable SOURCES to define the C/C++ source files for your TLM set( SOURCES templatetlm.cc ) # The include(tlm) statement will cause the SoftPLC Toolkit header directory # and your current source directory (where your CMakeLists.txt file is located) # to be used by the compiler as include directories for header files. # You can add additional ones using this function. Un-comment the line below and # separate directories with a space. LibXml2 is shown as an example, using the # variable pre-defined by the SoftPLC Toolkit. #include_directories( ${LIBXML2_INCLUDE_DIR} ) # This creates a shared library target for CMake to build, using your TLM name # and defined SOURCES. You should not need to change this line. add_library( ${TLM} SHARED ${SOURCES} ) # The PREFIX and SUFFIX properties are specified to produce a correctly-named # 'mytlm.tlm.so' output. set_target_properties( ${TLM} PROPERTIES PREFIX "" SUFFIX ".tlm.so" ) # If your TLM makes use of any libraries, uncomment the appropriate line below which # adds the needed libraries so that CMake will link against them. The two most common # needed libraries are the SoftPLC COMIO library and the industry standard libxml2 # library, and these each are called in by variables pre-defined in this SoftPLC Toolkit. target_link_libraries( ${TLM} # ${LIBCAN_LIBRARY} # ${LIBXML2_LIBRARIES} # ${LIBSEXPR_LIBRARY} # ${LIBCOMM_LIBRARY} # ${LIBUSB_LIBRARIES} ${LIBSTATE_LOGIC_LIBRARY} rt ) # The install lines below establish the directory to which the files listed are # installed. The second line (commented-out) shows an example of copying a # configuration file as well as the TLM binary. These are used when producing # a package file with your TLM (run 'make package'). # Note that you can have multiple install() commands with a different DESTINATION # if you need to put files in places other than /SoftPLC/tlm/ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${TLM}.tlm.so DESTINATION /SoftPLC/tlm/ ) #install( FILES MYTLMCFG.LST DESTINATION /SoftPLC/tlm/ ) # Edit this to pass your TLM 'configuration' file(s) to add_conffiles() and uncomment it. # A configuration file is one that you do not want overwritten when the package # is upgraded by an installation of a newer version of your 'package'. # # Note: Use full path names as viewed on the target SoftPLC. # # Note: Comment this out if you do not have any configuration files. If you do # use this, make sure you also use install() also on each of these files. # #add_conffiles( /SoftPLC/tlm/MYTLMCFG.LST ) # This includes the CPack module (installed with CMake), which is required for # packaging of your TLM files into an installable *.deb package file. include(CPack)