# # hello/CMakeLists.txt -- # cmake_minimum_required(VERSION 2.6) project(HELLO) add_executable(hello-naive hello-naive.c) add_executable(hello-naive-static hello-naive.c) set_property(TARGET hello-naive-static APPEND PROPERTY LINK_FLAGS "-static") add_executable(hello-stdio hello-stdio.c) add_executable(hello-sleep hello-sleep.c) add_executable(hello-signal hello-signal.c) add_executable(hello-write hello-write.c) add_executable(hello-write-static hello-write.c) set_property(TARGET hello-write-static APPEND PROPERTY LINK_FLAGS "-static") add_executable(hello-writev hello-writev.c) add_executable(hello-syscall hello-syscall.c) add_executable(hello-atexit hello-atexit.c) add_executable(hello-snowman hello-snowman.c) add_executable(hello-gettext hello-gettext.c) add_executable(hello-cpp hello-cpp.cc) enable_language(ASM) add_executable(hello-asm-libc hello-asm-libc.s) set_property(TARGET hello-asm-libc APPEND PROPERTY LINK_FLAGS "-static") add_executable(hello-asm-syscall hello-asm-syscall.s) set_property(TARGET hello-asm-syscall APPEND PROPERTY LINK_FLAGS "-static -nostdlib") INCLUDE(FindPkgConfig) pkg_check_modules(GLIB2 glib-2.0) add_definitions(${GLIB2_CFLAGS}) add_executable(hello-glib hello-glib.c) target_link_libraries(hello-glib ${GLIB2_LDFLAGS}) add_executable(hello-glib-event hello-glib-event.c) target_link_libraries(hello-glib-event ${GLIB2_LDFLAGS}) add_executable(hello-glib-threads hello-glib-event.c) target_link_libraries(hello-glib-threads ${GLIB2_LDFLAGS}) INCLUDE(FindIntl) target_link_libraries(hello-gettext ${Intl_LIBRARIES}) target_include_directories(hello-gettext PUBLIC ${Intl_INCLUDE_DIRS}) if(CMAKE_C_COMPILER_ID MATCHES "GNU") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99 -O2 -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall") endif() if(CMAKE_C_COMPILER_ID MATCHES "Clang") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99 -O2 -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall") endif()