mirror of
https://github.com/ModOrganizer2/cmake_common.git
synced 2026-07-27 14:06:46 -07:00
46 lines
1.3 KiB
CMake
46 lines
1.3 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
include(${CMAKE_CURRENT_LIST_DIR}/cpp.cmake)
|
|
|
|
if(NOT DEFINED install_dir)
|
|
set(install_dir bin/plugins)
|
|
endif()
|
|
|
|
function(set_project_to_run_from_install)
|
|
set(vcxproj_user_file "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.vcxproj.user")
|
|
|
|
get_target_property(output_name ${PROJECT_NAME} OUTPUT_NAME)
|
|
if("${output_name}" STREQUAL "output_name-NOTFOUND")
|
|
set(output_name ${PROJECT_NAME})
|
|
endif()
|
|
|
|
if(NOT EXISTS ${vcxproj_user_file})
|
|
file(WRITE ${vcxproj_user_file}
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
|
|
<Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
|
|
<PropertyGroup>
|
|
<LocalDebuggerWorkingDirectory>${CMAKE_INSTALL_PREFIX}/bin</LocalDebuggerWorkingDirectory>
|
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
|
<LocalDebuggerCommand>${CMAKE_INSTALL_PREFIX}/bin/ModOrganizer.exe</LocalDebuggerCommand>
|
|
</PropertyGroup>
|
|
</Project>")
|
|
endif()
|
|
endfunction()
|
|
|
|
macro(do_project)
|
|
do_cpp_project()
|
|
endmacro()
|
|
|
|
|
|
macro(do_src)
|
|
cpp_pre_target()
|
|
|
|
add_library(${PROJECT_NAME} SHARED ${input_files})
|
|
target_link_libraries(${PROJECT_NAME} uibase)
|
|
|
|
set_project_to_run_from_install()
|
|
cpp_post_target()
|
|
|
|
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${install_dir})
|
|
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION pdb)
|
|
endmacro()
|