icinga2/tools/mkclass/CMakeLists.txt

52 lines
2.0 KiB
CMake
Raw Normal View History

2013-11-03 13:45:26 +01:00
# Icinga 2
2015-01-22 12:00:23 +01:00
# Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)
2013-11-03 13:45:26 +01:00
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
find_package(BISON 2.3.0 REQUIRED)
find_package(FLEX 2.5.31 REQUIRED)
2013-11-03 13:45:26 +01:00
bison_target(class_parser class_parser.yy ${CMAKE_CURRENT_BINARY_DIR}/class_parser.cc)
flex_target(class_lexer class_lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/class_lexer.cc)
add_flex_bison_dependency(class_lexer class_parser)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/class_parser.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register")
set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/class_lexer.cc PROPERTY COMPILE_FLAGS "-Wno-deprecated-register")
endif()
2013-11-03 13:45:26 +01:00
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
2014-05-25 16:23:35 +02:00
add_executable(mkclass mkclass.cpp classcompiler.cpp classcompiler.hpp ${FLEX_class_lexer_OUTPUTS} ${BISON_class_parser_OUTPUTS})
2013-11-03 13:45:26 +01:00
2014-09-10 15:24:08 +02:00
if(WIN32)
target_link_libraries(mkclass shlwapi)
endif()
2013-11-03 13:45:26 +01:00
set_target_properties (
mkclass PROPERTIES
FOLDER Bin
)
macro(MKCLASS_TARGET ClassInput ClassImplOutput ClassHeaderOutput)
2013-11-03 13:45:26 +01:00
add_custom_command(
OUTPUT ${ClassImplOutput} ${ClassHeaderOutput}
2013-11-03 13:45:26 +01:00
COMMAND mkclass
ARGS ${ClassInput} ${CMAKE_CURRENT_BINARY_DIR}/${ClassImplOutput} ${CMAKE_CURRENT_BINARY_DIR}/${ClassHeaderOutput}
2013-11-03 13:45:26 +01:00
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS mkclass ${ClassInput}
)
endmacro()