Skip to content

Commit

Permalink
Add /utf-8 flag when compiling with MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
DolphyWind committed Jan 28, 2024
1 parent 77f33ce commit 52497bb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 20)
set(TARGET_BINARY_NAME electra)

if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(ElectraLang VERSION 1.0.0)

file(GLOB SOURCE_FILES "./src/*.cpp")
add_executable(electra ${SOURCE_FILES})
add_executable(${TARGET_BINARY_NAME} ${SOURCE_FILES})

target_include_directories(electra PUBLIC include)
target_include_directories(${TARGET_BINARY_NAME} PUBLIC include)

set(BOOST_REGEX_STANDALONE ON)
add_subdirectory(include/thirdparty/regex)
target_link_libraries(electra PRIVATE Boost::regex)
target_link_libraries(${TARGET_BINARY_NAME} PRIVATE Boost::regex)

if(WIN32)
target_compile_definitions(${TARGET_BINARY_NAME} PRIVATE /utf-8)
endif()

if(NOT WIN32)
install(TARGETS electra DESTINATION bin)
install(TARGETS ${TARGET_BINARY_NAME} DESTINATION bin)
endif()

0 comments on commit 52497bb

Please sign in to comment.