• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1project(exec C)
2
3cmake_minimum_required(VERSION 3.4.3)
4
5include(CheckCCompilerFlag)
6check_c_compiler_flag("-std=c99" C99_SUPPORTED)
7if (C99_SUPPORTED)
8    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
9endif()
10
11include(CheckFunctionExists)
12include(CheckSymbolExists)
13
14add_definitions(-D_GNU_SOURCE)
15list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
16
17check_function_exists(execve HAVE_EXECVE)
18check_function_exists(execv HAVE_EXECV)
19check_function_exists(execvpe HAVE_EXECVPE)
20check_function_exists(execvp HAVE_EXECVP)
21check_function_exists(execvP HAVE_EXECVP2)
22check_function_exists(exect HAVE_EXECT)
23check_function_exists(execl HAVE_EXECL)
24check_function_exists(execlp HAVE_EXECLP)
25check_function_exists(execle HAVE_EXECLE)
26check_function_exists(posix_spawn HAVE_POSIX_SPAWN)
27check_function_exists(posix_spawnp HAVE_POSIX_SPAWNP)
28
29configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
30include_directories(${CMAKE_CURRENT_BINARY_DIR})
31
32add_executable(exec main.c)
33