# GMM (C) 2018 Stephane Charette <stephanecharette@gmail.com>
# $Id: CMakeLists.txt 2601 2018-09-15 20:40:24Z stephane $

IF ( WIN32 )

	# msbuild.exe OPCConsole.sln /verbosity:minimal /maxcpucount /ds /property:Configuration=Release,Platform="Any CPU" /target:clean
	# msbuild.exe OPCConsole.sln /verbosity:minimal /maxcpucount /ds /property:Configuration=Release,Platform="Any CPU" /target:OPCConsole

	ADD_CUSTOM_TARGET (
		opc_build
		COMMAND build.bat
		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
		COMMENT "Building C# console OPC application" VERBATIM )

	FILE ( GLOB OPC_CMD ${CMAKE_CURRENT_SOURCE_DIR}/*.cmd )
	FILE ( GLOB OPC_DLL ${CMAKE_CURRENT_SOURCE_DIR}/OPCConsole/bin/Release/netcoreapp2.0/* )

	SET ( OPC_FILES ${OPC_CMD} ${OPC_DLL} )
	LIST ( SORT OPC_FILES )

	FOREACH ( OPC_FILE ${OPC_FILES} )
		MESSAGE ( "OPC file to install: ${OPC_FILE}" )
		INSTALL ( FILES ${OPC_FILE} DESTINATION bin )
	ENDFOREACH ()

	# NOTE:  The user will be required to have the Microsoft .NET Core Runtime SDK which can be found here:  https://www.microsoft.com/net/download

ENDIF ()
