Improve binary distribution CMake macros (issue #1923)

This commit is contained in:
Marshall Greenblatt 2016-06-14 18:28:00 -04:00
parent eb199b2547
commit f5b910326d
3 changed files with 13 additions and 9 deletions

View File

@ -81,11 +81,15 @@ endmacro()
# Determine the target output directory based on platform and generator. # Determine the target output directory based on platform and generator.
macro(SET_CEF_TARGET_OUT_DIR) macro(SET_CEF_TARGET_OUT_DIR)
if(${CMAKE_GENERATOR} STREQUAL "Ninja") if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
# Ninja does not create a subdirectory named after the configuration. ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") # By default Ninja and Make builds don't create a subdirectory named after
elseif(OS_LINUX) # the configuration.
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}") set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
# Output binaries (executables, libraries) to the correct directory.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR})
else() else()
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>") set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
endif() endif()
@ -256,13 +260,13 @@ endif(OS_MACOSX)
if(OS_WINDOWS) if(OS_WINDOWS)
# Add custom manifest files to an executable target. # Add custom manifest files to an executable target.
macro(ADD_WINDOWS_MANIFEST manifest_path target) macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
add_custom_command( add_custom_command(
TARGET ${target} TARGET ${target}
POST_BUILD POST_BUILD
COMMAND "mt.exe" -nologo COMMAND "mt.exe" -nologo
-manifest \"${manifest_path}/${target}.exe.manifest\" \"${manifest_path}/compatibility.manifest\" -manifest \"${manifest_path}/${target}.${extension}.manifest\" \"${manifest_path}/compatibility.manifest\"
-outputresource:"${CEF_TARGET_OUT_DIR}/${target}.exe"\;\#1 -outputresource:"${CEF_TARGET_OUT_DIR}/${target}.${extension}"\;\#1
COMMENT "Adding manifest..." COMMENT "Adding manifest..."
) )
endmacro() endmacro()

View File

@ -246,7 +246,7 @@ if(OS_WINDOWS)
endif() endif()
# Add the custom manifest files to the executable. # Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}") ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}/resources/win" "${CEF_TARGET}" "exe")
# Copy CEF binary and resource files to the target output directory. # Copy CEF binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}") COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")

View File

@ -157,7 +157,7 @@ if(OS_WINDOWS)
endif() endif()
# Add the custom manifest files to the executable. # Add the custom manifest files to the executable.
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}") ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}" "exe")
# Copy binary and resource files to the target output directory. # Copy binary and resource files to the target output directory.
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}") COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")