kicad/bitmaps/CMakeLists.txt

31 lines
1.1 KiB
CMake
Raw Normal View History

2008-05-17 19:24:22 +00:00
# Generate a static library target named "bitmaps"
# (with filename libbitmaps.a on Linux)
# Copy the *.xpm files to ${XPM_CPP_PATH}/*.cpp, on change only.
2008-05-17 19:24:22 +00:00
# Compile those *.cpp files and put them into the library, then done.
2008-07-12 12:16:18 +00:00
# builds a set of all the .xpm files
file(GLOB BITMAP_SRCS *.xpm)
2008-05-17 19:24:22 +00:00
2008-06-06 12:39:00 +00:00
# Get the path of the *.xpm files into "PATH"
set(PATH ${CMAKE_CURRENT_SOURCE_DIR})
#message("PATH = ${PATH}")
2008-05-17 19:24:22 +00:00
# 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")
2008-06-06 12:39:00 +00:00
foreach(LOOP_VAR ${BITMAP_SRCS})
get_filename_component(BASENAME ${LOOP_VAR} NAME_WE)
set(CPP_BITMAP "${XPM_CPP_PATH}/${BASENAME}.cpp")
2008-05-17 19:24:22 +00:00
add_custom_command(
2008-06-06 12:39:00 +00:00
OUTPUT ${CPP_BITMAP}
COMMAND cmake -E copy "${PATH}/${BASENAME}.xpm" "${CPP_BITMAP}"
2008-06-06 12:39:00 +00:00
DEPENDS ${BASENAME}.xpm)
list(APPEND CPP_BITMAPS ${CPP_BITMAP})
set_source_files_properties(${CPP_BITMAP} PROPERTIES COMPILE_FLAGS -DXPMMAIN)
endforeach(LOOP_VAR)
2008-05-17 19:24:22 +00:00
2008-06-06 12:39:00 +00:00
add_library(bitmaps ${CPP_BITMAPS})