Files
sdbus-cpp/tools/CMakeLists.txt
T
bobrofon fb008445b1 xml2cpp: Add missing EXPAT include dirs (#136)
This patch is required if EXPAT library is installed in non-standard location.
Without 'target_include_directories' cmake will find EXPAT library:
  ...
  -- Found EXPAT: .../lib/libexpat.a (found version "2.2.10")
  ...

But 'xml.cpp' compilation will fail with error:
  ...
  tools/xml2cpp-codegen/xml.cpp:7:10: fatal error: expat.h: No such file or directory
    7 | #include <expat.h>
  ...
2021-03-12 13:17:55 +01:00

53 lines
1.4 KiB
CMake

#-------------------------------
# PROJECT INFORMATION
#-------------------------------
cmake_minimum_required(VERSION 3.5)
project(sdbus-c++-tools)
include(GNUInstallDirs)
#-------------------------------
# PERFORMING CHECKS
#-------------------------------
find_package(EXPAT REQUIRED)
#-------------------------------
# SOURCE FILES CONFIGURATION
#-------------------------------
set(SDBUSCPP_XML2CPP_SRCS
xml2cpp-codegen/xml2cpp.cpp
xml2cpp-codegen/xml.h
xml2cpp-codegen/xml.cpp
xml2cpp-codegen/generator_utils.h
xml2cpp-codegen/generator_utils.cpp
xml2cpp-codegen/BaseGenerator.h
xml2cpp-codegen/BaseGenerator.cpp
xml2cpp-codegen/AdaptorGenerator.h
xml2cpp-codegen/AdaptorGenerator.cpp
xml2cpp-codegen/ProxyGenerator.h
xml2cpp-codegen/ProxyGenerator.cpp)
#-------------------------------
# GENERAL COMPILER CONFIGURATION
#-------------------------------
set(CMAKE_CXX_STANDARD 14)
#----------------------------------
# EXECUTABLE BUILD INFORMATION
#----------------------------------
add_executable(sdbus-c++-xml2cpp ${SDBUSCPP_XML2CPP_SRCS})
target_link_libraries (sdbus-c++-xml2cpp ${EXPAT_LIBRARIES})
target_include_directories(sdbus-c++-xml2cpp PRIVATE ${EXPAT_INCLUDE_DIRS})
#----------------------------------
# INSTALLATION
#----------------------------------
install(TARGETS sdbus-c++-xml2cpp EXPORT sdbus-c++-xml2cpp DESTINATION ${CMAKE_INSTALL_BINDIR})