Skip to content

Commit

Permalink
Fixup for getopt on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
subhacom committed Jun 12, 2024
1 parent d6bc7ff commit 1d8de04
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ add_definitions(-DUSE_GENESIS_PARSER)
if(MSVC)
add_definitions(-D_USE_MATH_DEFINES)
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} /bigobj)
elseif(APPLE)
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} "-std=c++17")
endif()

if(DEBUG OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
Expand Down Expand Up @@ -145,7 +147,12 @@ endif()
################################### TARGETS ####################################

link_directories(${CMAKE_BINARY_DIR})
add_library(libmoose SHARED basecode/main.cpp external/getopt/getopt.c)
if(WIN32)
add_library(libmoose SHARED basecode/main.cpp external/getopt/getopt.c)
else()
add_library(libmoose SHARED basecode/main.cpp)
endif(WIN32)

set_target_properties(libmoose PROPERTIES PREFIX "")
add_executable(moose.bin basecode/main.cpp)

Expand Down Expand Up @@ -296,7 +303,7 @@ list(APPEND MOOSE_LIBRARIES
)

# If windows MSVC, include port of getopt
if(MSVC)
if(WIN32)
list(APPEND MOOSE_LIBRARIES getopt)
target_include_directories(moose.bin PRIVATE external/getopt)
target_include_directories(libmoose PRIVATE external/getopt)
Expand Down

0 comments on commit 1d8de04

Please sign in to comment.