
if(${CMAKE_C_COMPILER_ID} MATCHES "Clang")
  set(CMAKE_C_FLAGS "-Wall -g -std=c99 -pedantic -DDEBUG")
  set(CMAKE_SHARED_LINKER_FLAGS " -undefined dynamic_lookup -flat_namespace")
else()
  #set(CMAKE_C_FLAGS "-Wall -g -O3 -std=gnu99 -pedantic -DDEBUG -lm")
  set(CMAKE_C_FLAGS "-Wall -g -O3 -std=gnu99 -pedantic -DDEBUG -lm")
endif()

include_directories(${PROJECT_SOURCE_DIR}/src/include)

# turn on shared libraries
set(BUILD_SHARED_LIBS 1)

# Define an insomniac compile command.
macro(INSC_TARGET Name Input Output)
    set(INSC_TARGET_outputs "${CMAKE_CURRENT_BINARY_DIR}/${Output}")

    set(INSC_TARGET_usage "INSC_TARGET(<Name> <Input> <Output>)")

    add_custom_command(OUTPUT ${Output}
        COMMAND ${CMAKE_BINARY_DIR}/src/insc ${Input} -o ${INSC_TARGET_outputs}
        VERBATIM
        DEPENDS ${Input} insc
        COMMENT "[INSC] Compiling Insomniac Scheme code to ${INSC_TARGET_outputs}"
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

    set(INSC_${Name}_OUTPUTS "${INSC_TARGET_outputs}")
endmacro()

# Define a


if(${CMAKE_C_COMPILER_ID} MATCHES "Clang")
  set(CMAKE_C_FLAGS "-Wall -g -std=c99 -pedantic -DDEBUG -Wno-gnu-statement-expression")
  set(CMAKE_SHARED_LINKER_FLAGS " -undefined dynamic_lookup -flat_namespace")
else()
  set(CMAKE_C_FLAGS "-Wall -g -O3 -std=gnu99 -pedantic -DDEBUG -lm")
endif()

include_directories(${PROJECT_SOURCE_DIR}/src/include)

# turn on shared libraries
set(BUILD_SHARED_LIBS 1)

# Define an insomniac compile command.
macro(INSC_TARGET Name Input Output)
    set(INSC_TARGET_outputs "${CMAKE_CURRENT_BINARY_DIR}/${Output}")

    set(INSC_TARGET_usage "INSC_TARGET(<Name> <Input> <Output>)")

    add_custom_command(OUTPUT ${Output}
        COMMAND ${CMAKE_BINARY_DIR}/src/insc ${Input} -o ${INSC_TARGET_outputs}
        VERBATIM
        DEPENDS ${Input} insc
        COMMENT "[INSC] Compiling Insomniac Scheme code to ${INSC_TARGET_outputs}"
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

    set(INSC_${Name}_OUTPUTS "${INSC_TARGET_outputs}")
endmacro()

# Define a

Disable warning about gnu statement expressions.
Disable warning about gnu statement expressions.
