2011-03-27 02:18:56 -06:00
|
|
|
# - Try to find the MakeNSIS
|
|
|
|
# Once done this will define
|
|
|
|
#
|
|
|
|
# MAKENSIS_FOUND - system has MakeNSIS
|
|
|
|
# MAKENSIS - the MakeNSIS program
|
|
|
|
# MAKENSIS_FLAGS - the MakeNSIS flags
|
|
|
|
# MAKENSIS_SUFFIX - the MakeNSIS output file suffix
|
|
|
|
|
|
|
|
# Copyright (c) 2011, Pali Rohár <pali.rohar@gmail.com>
|
|
|
|
#
|
|
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
|
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
|
|
|
|
|
|
if(MAKENSIS)
|
|
|
|
set(MAKENSIS_FOUND true)
|
|
|
|
else()
|
2015-11-26 06:12:53 -07:00
|
|
|
find_program(MAKENSIS NAMES makensis HINTS "C:/Program Files/NSIS" "C:/Program Files (x86)/NSIS")
|
2011-03-27 02:18:56 -06:00
|
|
|
find_package(SelfPackers)
|
|
|
|
|
2012-05-27 14:53:10 -06:00
|
|
|
set(MAKENSIS_ADDITIONAL_FLAGS "" CACHE STRING "Additional flags for makensis")
|
|
|
|
|
2011-03-27 02:18:56 -06:00
|
|
|
if(MAKENSIS)
|
|
|
|
set(MAKENSIS_FOUND true)
|
|
|
|
message(STATUS "Found MakeNSIS: ${MAKENSIS}")
|
|
|
|
else()
|
|
|
|
set(MAKENSIS_FOUND false)
|
2011-04-02 02:32:11 -06:00
|
|
|
# message(FATAL_ERROR "Could not find program MakeNSIS") # TODO: This fail if REQUIRED is not used too!
|
|
|
|
message(STATUS "Could not find program MakeNSIS")
|
2011-03-27 02:18:56 -06:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT CMAKE_VERBOSE_MAKEFILE)
|
|
|
|
set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -V2 -DQUIET)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -DDBG)
|
|
|
|
set(MAKENSIS_SUFFIX ${MAKENSIS_SUFFIX}-debug)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_SIZEOF_VOID_P STREQUAL 8)
|
|
|
|
set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -DX86_64)
|
|
|
|
set(MAKENSIS_SUFFIX ${MAKENSIS_SUFFIX}-x86_64)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_UPX AND SELF_PACKER_FOR_EXECUTABLE)
|
|
|
|
set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -DUPX=${SELF_PACKER_FOR_EXECUTABLE} -DUPX_FLAGS=${SELF_PACKER_FOR_EXECUTABLE_FLAGS})
|
|
|
|
endif()
|
|
|
|
|
2012-05-27 14:53:10 -06:00
|
|
|
set(MAKENSIS_FLAGS ${MAKENSIS_ADDITIONAL_FLAGS} ${MAKENSIS_FLAGS} -NOCD CACHE STRING "")
|
2011-03-27 02:18:56 -06:00
|
|
|
set(MAKENSIS_SUFFIX ${MAKENSIS_SUFFIX}${CMAKE_EXECUTABLE_SUFFIX} CACHE STRING "")
|
|
|
|
|
|
|
|
mark_as_advanced(MAKENSIS MAKENSIS_FLAGS MAKENSIS_SUFFIX)
|
|
|
|
endif()
|