Skip to content

Instantly share code, notes, and snippets.

@SammyJames
Created December 31, 2014 04:09
Show Gist options
  • Save SammyJames/6ea569dd404217fd0976 to your computer and use it in GitHub Desktop.
Save SammyJames/6ea569dd404217fd0976 to your computer and use it in GitHub Desktop.
project(MasterBuilder)
cmake_minimum_required(VERSION 2.8)
# find Google protobuf
find_package(Protobuf REQUIRED)
# todo - invoke protoc
include_directories(${PROTOBUF_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS Messages.proto)
# shared
set(SharedSources
Shared/Application.cpp
Shared/Messaging.cpp
)
set(SharedHeaders
Shared/Application.h
Shared/ApplicationState.h
Shared/Messaging.h
)
set(SharedIncludes
Shared
Generated
)
# master
set(MBSources
MasterBuilder/ApplicationState_Running.cpp
MasterBuilder/ApplicationState_Shutdown.cpp
MasterBuilder/ApplicationState_Startup.cpp
MasterBuilder/CitizenDB.cpp
MasterBuilder/MasterBuilderApplication.cpp
MasterBuilder/MasterSocket.cpp
MasterBuilder/main.cpp)
set(MBHeaders
MasterBuilder/ApplicationState_Running.h
MasterBuilder/ApplicationState_Shutdown.h
MasterBuilder/ApplicationState_Startup.h
MasterBuilder/CitizenDB.h
MasterBuilder/MasterBuilderApplication.h
MasterBuilder/MasterSocket.h)
set(MBIncludes
MasterBuilder)
add_executable(MasterBuilder ${MBSources} ${MBHeaders}
${SharedSources} ${SharedHeaders} ${PROTO_SRCS} ${PROTO_HDRS})
# C++11 is a requirement
set_property(TARGET MasterBuilder PROPERTY CXX_STANDARD 11)
set_property(TARGET MasterBuilder PROPERTY CXX_STANDARD_REQUIRED ON)
# also force manually (for older cmake)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
target_include_directories(MasterBuilder PUBLIC ${MBIncludes} ${SharedIncludes}
${PROTOBUF_INCLUDE_DIRS})
target_link_libraries(MasterBuilder ${PROTOBUF_LIBRARIES})
# citizen
set(CBSources
CitizenBuilder/AppState_Running.cpp
CitizenBuilder/AppState_Shutdown.cpp
CitizenBuilder/AppState_Startup.cpp
CitizenBuilder/CitizenBuilder.cpp
CitizenBuilder/CitizenSocket.cpp
CitizenBuilder/main.cpp)
set(CBHeaders
CitizenBuilder/AppState_Running.h
CitizenBuilder/AppState_Shutdown.h
CitizenBuilder/AppState_Startup.h
CitizenBuilder/CitizenBuilder.h
CitizenBuilder/CitizenSocket.h)
set(CBIncludes
CitizenBuilder)
add_executable(CitizenBuilder ${CBSources} ${CBHeaders}
${SharedSources} ${SharedHeaders} ${PROTO_SRCS} ${PROTO_HDRS})
# C++11 is a requirement
set_property(TARGET CitizenBuilder PROPERTY CXX_STANDARD 11)
set_property(TARGET CitizenBuilder PROPERTY CXX_STANDARD_REQUIRED ON)
# also force manually (for older cmake)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
target_include_directories(CitizenBuilder PUBLIC ${CBIncludes} ${SharedIncludes}
${PROTOBUF_INCLUDE_DIRS})
target_link_libraries(CitizenBuilder ${PROTOBUF_LIBRARIES})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment