Commit 459e3002 authored by raburton's avatar raburton

allow xpm_cpp_path to be set at configure time

allows you to more easily keep your generated resources out
of the source tree
parent 29c0ce78
# Generate a static library target named "bitmaps" # Generate a static library target named "bitmaps"
# (with filename libbitmaps.a on Linux) # (with filename libbitmaps.a on Linux)
# Copy the *.xmp files to bitmaps/${XMP_CPP_DIR}/${BASENAME}.cpp, on change only. # Copy the *.xpm files to ${XPM_CPP_PATH}/*.cpp, on change only.
# Compile those *.cpp files and put them into the library, then done. # Compile those *.cpp files and put them into the library, then done.
set(BITMAP_SRCS set(BITMAP_SRCS
...@@ -383,17 +383,17 @@ set(BITMAP_SRCS ...@@ -383,17 +383,17 @@ set(BITMAP_SRCS
viewlibs_icon.xpm viewlibs_icon.xpm
) )
# The name of the directory to put the copied and renamed *.xpm files into
# just below the bitmaps directory. As files are copied they are renamed to *.cpp.
set(XMP_CPP_DIR auto_renamed_to_cpp)
# Get the path of the *.xpm files into "PATH" # Get the path of the *.xpm files into "PATH"
set(PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(PATH ${CMAKE_CURRENT_SOURCE_DIR})
#message("PATH = ${PATH}") #message("PATH = ${PATH}")
# The name of the directory to put the copied and renamed *.xpm files into.
# As files are copied they are renamed to *.cpp.
set(XPM_CPP_PATH "${PATH}/auto_renamed_to_cpp" CACHE PATH "path to store renamed .xpm files for compilation" )
foreach(LOOP_VAR ${BITMAP_SRCS}) foreach(LOOP_VAR ${BITMAP_SRCS})
get_filename_component(BASENAME ${LOOP_VAR} NAME_WE) get_filename_component(BASENAME ${LOOP_VAR} NAME_WE)
set(CPP_BITMAP "${PATH}/${XMP_CPP_DIR}/${BASENAME}.cpp") set(CPP_BITMAP "${XPM_CPP_PATH}/${BASENAME}.cpp")
add_custom_command( add_custom_command(
OUTPUT ${CPP_BITMAP} OUTPUT ${CPP_BITMAP}
COMMAND cmake -E copy '${PATH}/${BASENAME}.xpm' '${CPP_BITMAP}' COMMAND cmake -E copy '${PATH}/${BASENAME}.xpm' '${CPP_BITMAP}'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment