Skip to content

Commit

Permalink
CMake: Fix errors when path contains spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas W authored and Lukas W committed Jun 20, 2018
1 parent 583e42e commit d1c36d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
CMAKE_PARSE_ARGUMENTS(PLUGIN "" "" "MOCFILES;EMBEDDED_RESOURCES;UICFILES;LINK" ${ARGN})
SET(PLUGIN_SOURCES ${PLUGIN_UNPARSED_ARGUMENTS})

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/gui)
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/src/gui")

ADD_DEFINITIONS(-DPLUGIN_NAME=${PLUGIN_NAME})

Expand All @@ -20,15 +20,15 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
FILE(GLOB EXPANDED "${ARG}")
LIST(SORT EXPANDED)
FOREACH(ITEM ${EXPANDED})
LIST(APPEND NEW_ARGS ${ITEM})
LIST(APPEND NEW_ARGS "${ITEM}")
ENDFOREACH()
ENDFOREACH()
SET(PLUGIN_EMBEDDED_RESOURCES ${NEW_ARGS})

SET(ER_H ${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h)
SET(ER_H "${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h")
ADD_CUSTOM_COMMAND(OUTPUT ${ER_H}
COMMAND ${BIN2RES}
ARGS ${PLUGIN_EMBEDDED_RESOURCES} > ${ER_H}
ARGS ${PLUGIN_EMBEDDED_RESOURCES} > "${ER_H}"
DEPENDS bin2res)
ENDIF(ER_LEN)

Expand All @@ -45,11 +45,11 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
ENDFOREACH(f)

IF(LMMS_BUILD_APPLE)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
LINK_DIRECTORIES("${CMAKE_BINARY_DIR}")
LINK_LIBRARIES(${QT_LIBRARIES})
ENDIF(LMMS_BUILD_APPLE)
IF(LMMS_BUILD_WIN32)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
LINK_DIRECTORIES("${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}")
LINK_LIBRARIES(${QT_LIBRARIES})
ENDIF(LMMS_BUILD_WIN32)
IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand All @@ -73,12 +73,12 @@ MACRO(BUILD_PLUGIN PLUGIN_NAME)
INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}")

IF(LMMS_BUILD_APPLE)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader ${CMAKE_BINARY_DIR}/lmms")
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LINK_FLAGS "-bundle_loader \"${CMAKE_BINARY_DIR}/lmms\"")
ADD_DEPENDENCIES(${PLUGIN_NAME} lmms)
ENDIF(LMMS_BUILD_APPLE)
IF(LMMS_BUILD_WIN32)
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES PREFIX "")
ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} $<TARGET_FILE:${PLUGIN_NAME}>)
ADD_CUSTOM_COMMAND(TARGET ${PLUGIN_NAME} POST_BUILD COMMAND ${STRIP} "$<TARGET_FILE:${PLUGIN_NAME}>")
ENDIF(LMMS_BUILD_WIN32)

SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ER_H} ${plugin_MOC_out}")
Expand Down
4 changes: 2 additions & 2 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

# Enable C++11
ADD_DEFINITIONS(-std=c++0x)
Expand Down

0 comments on commit d1c36d7

Please sign in to comment.