我正在尝试.msi
使用cmake
. .dll
我能够.lib
在CMakeLists.txt
. 请提供一个示例CMakeLists.txt
来生成.msi
安装程序。我需要在命令提示符中使用哪些命令?
到目前为止,我使用的命令是:
> cmake -G"Visual Studio 10" -H"Root CMakeLists.txt path" -B"path to generate the sln"
> cmake --build "path of the sln" --config Release
> cpack -C Release
output: CPack Error: CPack generator not specified
我使用以下配置来生成.dll
和.lib
文件。
这是我的CMakeLists.txt
:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(mydll)
INCLUDE_DIRECTORIES(common/include)
SET(my_lib_src dllmain.cpp mydll.cpp )
SET_SOURCE_FILES_PROPERTIES(${my_lib_src} PROPERTIES LANGUAGE C)
ADD_LIBRARY(mydll SHARED ${my_lib_src})
SET_TARGET_PROPERTIES(mydll PROPERTIES
LINKER_LANGUAGE C
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/common/bin
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/common/bin
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/common/lib
ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/common/lib)
install(TARGETS mydll
ARCHIVE
DESTINATION lib
COMPONENT libraries)
install(FILES mydll.h
DESTINATION include
COMPONENT headers)
set(CPACK_GENERATOR WIX)
set(CPACK_PACKAGE_NAME "mydll")
set(CPACK_PACKAGE_VENDOR "CMake.org")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
INCLUDE(CPack)