diff --git a/cmake-embed b/cmake-embed new file mode 100644 index 0000000..729488a Binary files /dev/null and b/cmake-embed differ diff --git a/embed.cmake b/embed.cmake index a1cc2e4..9359af0 100644 --- a/embed.cmake +++ b/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 +#)