forked from google/flatbuffers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request google#7 from eile/master
Integrate PkgConfig work from @biddisco, allows sub project use
- Loading branch information
Showing
3 changed files
with
107 additions
and
65 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#----------------------------------------------------------------------------- | ||
# Include target definitions : | ||
# Skip them if flatc is already defined - this can be because it was compiled | ||
# as part of the same project using add_subdirectory | ||
#----------------------------------------------------------------------------- | ||
if(NOT TARGET flatc) | ||
include ("${CMAKE_CURRENT_LIST_DIR}/FlatBuffersTargets.cmake") | ||
endif () | ||
|
||
#----------------------------------------------------------------------------- | ||
# Include directories | ||
#----------------------------------------------------------------------------- | ||
set(FlatBuffers_INCLUDE_DIRS @FLATBUFFERS_INCLUDE_DIRS@) | ||
set(FlatBuffers_FOUND 1) | ||
|
||
# these are for compatibility with older cmake scripts | ||
set(FlatBuffers_INCLUDE_DIR @FLATBUFFERS_INCLUDE_DIRS@) | ||
set(FLATBUFFERS_INCLUDE_DIRS @FLATBUFFERS_INCLUDE_DIRS@) | ||
set(FLATBUFFERS_INCLUDE_DIR @FLATBUFFERS_INCLUDE_DIRS@) | ||
set(FLATBUFFERS_FLATC_EXECUTABLE flatc) | ||
|
||
#----------------------------------------------------------------------------- | ||
# function needed by dependent projects | ||
#----------------------------------------------------------------------------- | ||
function(flatbuffers_generate_c_headers Name) | ||
set(FLATC_OUTPUTS) | ||
foreach(FILE ${ARGN}) | ||
get_filename_component(FLATC_OUTPUT ${FILE} NAME_WE) | ||
set(FLATC_OUTPUT | ||
"${CMAKE_CURRENT_BINARY_DIR}/${FLATC_OUTPUT}_generated.h") | ||
list(APPEND FLATC_OUTPUTS ${FLATC_OUTPUT}) | ||
|
||
add_custom_command(OUTPUT ${FLATC_OUTPUT} | ||
COMMAND ${FLATBUFFERS_FLATC_EXECUTABLE} | ||
ARGS -c -o "${CMAKE_CURRENT_BINARY_DIR}/" ${FILE} | ||
COMMENT "Building C++ header for ${FILE}" | ||
DEPENDS ${FILE} ${FLATBUFFERS_FLATC_EXECUTABLE} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) | ||
endforeach() | ||
set(${Name}_OUTPUTS ${FLATC_OUTPUTS} PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters