mirror of
https://github.com/threeal/cmake-action.git
synced 2025-06-09 02:31:21 +00:00
add support in test project to choose C and/or C++ to compile
This commit is contained in:
parent
582c9a40fa
commit
2511f03a88
@ -1,9 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(test)
|
||||
|
||||
option(BUILD_C "build hello world in C Language" OFF)
|
||||
option(BUILD_CXX "build hello world in CXX Language" ON)
|
||||
option(BUILD_TXT "build hello world txt file" OFF)
|
||||
|
||||
add_executable(hello_world hello_world.cpp)
|
||||
if(BUILD_C)
|
||||
add_executable(hello_world_c hello_world.c)
|
||||
endif()
|
||||
|
||||
if(BUILD_CXX)
|
||||
add_executable(hello_world hello_world.cpp)
|
||||
endif()
|
||||
|
||||
if(BUILD_TXT)
|
||||
add_custom_target(
|
||||
|
6
test/hello_world.c
Normal file
6
test/hello_world.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello world!\n");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user