Don't mask bugs by catching all the throwables. (These were seen in the profiler...
[idea/community.git] / native / IdeaWin32 / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.1)
2 project(IdeaWin32)
3 include(CheckSymbolExists)
4
5 if(NOT WIN32)
6   message(FATAL_ERROR "Windows only.")
7 endif()
8
9 if (DEFINED ENV{BUILD_NUMBER})
10   set(BUILD_NUMBER $ENV{BUILD_NUMBER})
11 else()
12   set(BUILD_NUMBER 9999)
13 endif()
14
15 string(TIMESTAMP YEAR "%Y")
16
17 check_symbol_exists("_M_AMD64" "" TARGET_X64)
18 if(TARGET_X64)
19   set(FILE_NAME "IdeaWin64")
20   set(JAVA_HOME $ENV{JDK_18_x64})
21 else()
22   set(FILE_NAME "IdeaWin32")
23   set(JAVA_HOME $ENV{JDK_18})
24 endif()
25 if(NOT JAVA_HOME)
26   message(FATAL_ERROR "JDK_18/JDK_18_x64 variables not defined (x64=${TARGET_X64}).")
27 endif()
28
29 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
30 include_directories(${JAVA_HOME}/include ${JAVA_HOME}/include/win32)
31
32 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/IdeaWin32.rc ${CMAKE_CURRENT_BINARY_DIR}/IdeaWin32.rc @ONLY)
33
34 add_library(IdeaWin32 SHARED IdeaWin32.c IdeaWin32.h ${CMAKE_CURRENT_BINARY_DIR}/IdeaWin32.rc)
35
36 set_target_properties(IdeaWin32 PROPERTIES OUTPUT_NAME ${FILE_NAME})