Skip to content

Commit

Permalink
[Windows][noetic-devel] Generate executables without extension name. (#…
Browse files Browse the repository at this point in the history
…1061)

* generate exe without extension name.

* use NAME_WE to be compatible with CMake<3.14.

* Fixed the wrong reference.
  • Loading branch information
seanyen authored Feb 6, 2020
1 parent e681541 commit 3f57b47
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cmake/platform/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,23 @@ function(add_python_executable)
endif()

if(WIN32)
get_filename_component(WRAPPER_NAME
"${ARG_SCRIPT_NAME}"
NAME_WE)
set(
WRAPPER_SOURCE
"${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/add_python_executable/${ARG_TARGET_NAME}/${ARG_SCRIPT_NAME}.cpp")
"${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/add_python_executable/${ARG_TARGET_NAME}/${WRAPPER_NAME}.cpp")
configure_file(
"${catkin_EXTRAS_DIR}/templates/python_win32_wrapper.cpp.in"
"${WRAPPER_SOURCE}"
@ONLY)

add_executable(${ARG_TARGET_NAME} "${WRAPPER_SOURCE}")

# The actual file name of the executable built on Windows will be ${ARG_SCRIPT_NAME}.exe according to OUTPUT_NAME
# The actual file name of the executable built on Windows will be ${WRAPPER_NAME}.exe according to OUTPUT_NAME
set_target_properties(
${ARG_TARGET_NAME} PROPERTIES
OUTPUT_NAME "${ARG_SCRIPT_NAME}"
OUTPUT_NAME "${WRAPPER_NAME}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/windows_wrappers/${ARG_TARGET_NAME}")

install(
Expand Down

0 comments on commit 3f57b47

Please sign in to comment.