Fixed it up a little
This commit is contained in:
parent
d2d92394a7
commit
f92b94d96d
BIN
cmake-embed
Normal file
BIN
cmake-embed
Normal file
Binary file not shown.
33
embed.cmake
33
embed.cmake
@ -1,23 +1,42 @@
|
||||
|
||||
#
|
||||
#
|
||||
# Purpose, make a macro to automaticly convert files to headers with cross platform support
|
||||
# Purpose, make a macro to automaticly convert files to headers for inclusion with cross platform support
|
||||
#
|
||||
#
|
||||
|
||||
# TODO, fix embed adding cmake-embed target but not compiling the headers with the command
|
||||
# FIX, just compile the embed program and make your stuff manually
|
||||
|
||||
set(embed_target_dir ${CMAKE_CURRENT_LIST_DIR})
|
||||
macro(embed_files)
|
||||
set(args ${ARGN})
|
||||
if(NOT TARGET cmake-embed)
|
||||
project(cmake-embed)
|
||||
add_executable(nekohook embed.cpp)
|
||||
add_executable(cmake-embed ${embed_target_dir}/embed.cpp)
|
||||
endif()
|
||||
for()
|
||||
foreach(i IN LISTS ARGN)
|
||||
foreach(i ${ARGN})
|
||||
get_filename_component(WORKING_DIR ${i} DIRECTORY)
|
||||
add_custom_command(
|
||||
TARGET ${i}.h
|
||||
TARGET ${project}
|
||||
PRE_BUILD
|
||||
cmake-embed "${i}" "${i}.h"
|
||||
WORKING_DIRECTORY ${WORKING_DIR}
|
||||
COMMAND "cmake-embed ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i} ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h"
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}
|
||||
COMMENT "Generating header for: ${i}.h"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
VERBATIM
|
||||
)
|
||||
#add_dependencies(${project} "${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# add_custom_command that doesnt really let us make it a dependancy of
|
||||
#add_custom_command(
|
||||
# COMMAND "cmake-embed ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i} ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h"
|
||||
# DEPENDS cmake-embed
|
||||
# DEPENDS ${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}
|
||||
# COMMENT "Generating header for: ${i}.h"
|
||||
# OUTPUT "${CMAKE_SOURCE_DIR}/${WORKING_DIR}/${i}.h"
|
||||
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
# VERBATIM
|
||||
#)
|
||||
|
Loading…
x
Reference in New Issue
Block a user