# SoftPLC 4.x C/C++ Toolkit CMakeList.txt template for building a TLM. # Lines after a # are a comment. # Do not re-order these lines needlessly. # Set the name of your TLM by editing 'mytlm' to yours. This should be all # lower-case, but can include 0-9 and - if desired. set( TLM tdk ) # This defines the project as being a C++ project. project( ${TLM} CXX ) # This line is required by CMake cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) # 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 "This is driver for the TDK EZA2500-32048 DC-DC converter." ) # 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. # It should be kept in all CMakeLists files used for TLMs. include(tlm) include_directories( . ) # also look for headers in ${CMAKE_CURRENT_SOURCE_DIR} # Set a variable SOURCES to define the C++ source files for your TLM set( SOURCES tdk.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 two functions below specify that the C++ compiler and linker should be # used for the SOURCES and TLM target. This is recommended when building TLMs. # # The PREFIX and SUFFIX properties are specified to produce a correctly-named # 'mytlm.tlm.so' output. set_source_files_properties( ${SOURCES} PROPERTIES LANGUAGE CXX ) set_target_properties( ${TLM} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX ".tlm.so" ) # If your TLM makes use of any libraries, uncomment the appropriate lines below which # add the needed libraries so that CMake will link against them. The statements # are additive. target_link_libraries( ${TLM} ${LIBCOMM_LIBRARY} ) #target_link_libraries( ${TLM} ${LIBCAN_LIBRARY} ) target_link_libraries( ${TLM} ${LIBSTATE_LOGIC_LIBRARY} ) #target_link_libraries( ${TLM} ${LIBXML2_LIBRARIES} ) target_link_libraries( ${TLM} 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 # handling the packaging of your TLM files into an installable package file. # Do not move or remove this line! include(CPack)