1
0

CMake: Added resources to windows projects.

This commit is contained in:
madmaxoft 2014-01-13 17:15:34 +01:00
parent b9eb38a17f
commit 89e641071e

View File

@ -25,6 +25,15 @@ if (NOT MSVC)
list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/StackWalker.cpp" "${PROJECT_SOURCE_DIR}/LeakFinder.cpp") list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/StackWalker.cpp" "${PROJECT_SOURCE_DIR}/LeakFinder.cpp")
# If building a windows version, but not using MSVC, add the resources directly to the makefile:
if (WIN32)
FILE(GLOB ResourceFiles
"Resources/*.rc"
)
list(APPEND SOURCE "${ResourceFiles}")
endif()
else () else ()
# Generate the Bindings if they don't exist: # Generate the Bindings if they don't exist:
@ -37,12 +46,16 @@ else ()
) )
endif() endif()
# Add all subfolders as solution-folders:
list(APPEND FOLDERS "Resources")
function(includefolder PATH) function(includefolder PATH)
FILE(GLOB FOLDER_FILES FILE(GLOB FOLDER_FILES
"${PATH}/*.cpp" "${PATH}/*.cpp"
"${PATH}/*.h" "${PATH}/*.h"
"${PATH}/*.rc"
) )
source_group("${PATH}" FILES ${FOLDER_FILES}) source_group("${PATH}" FILES ${FOLDER_FILES})
message("Files included in folder " ${PATH} ": " "${FOLDER_FILES}")
endfunction(includefolder) endfunction(includefolder)
foreach(folder ${FOLDERS}) foreach(folder ${FOLDERS})
@ -69,9 +82,9 @@ else ()
SET_SOURCE_FILES_PROPERTIES( SET_SOURCE_FILES_PROPERTIES(
"StackWalker.cpp LeakFinder.h" PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\"" "StackWalker.cpp LeakFinder.h" PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\""
) )
list(APPEND SOURCE "Resources/MCServer.rc")
endif() endif()
set(EXECUTABLE MCServer) set(EXECUTABLE MCServer)
add_executable(${EXECUTABLE} ${SOURCE}) add_executable(${EXECUTABLE} ${SOURCE})