This commit is contained in:
zhangzhe 2023-03-14 21:07:39 +08:00
commit 37f297e278
4 changed files with 48 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build/*

41
CMakeLists.txt Normal file
View File

@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.6)
set(PROJECT_N hello)
SET(CMAKE_C_COMPILER /home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android22-clang)
SET(CMAKE_CXX_COMPILER /home/user/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android22-clang++)
project(${PROJECT_N} VERSION 1.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
file(GLOB_RECURSE SRCS ${PROJECT_SOURCE_DIR}/src/*.cpp)
# a macro that gets all of the header containing directories.
MACRO(header_directories return_list includes_base_folder extention )
FILE(GLOB_RECURSE new_list ${includes_base_folder}/*.${extention})
SET(dir_list "")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()
# using said macro.
header_directories(INCLUDES ${PROJECT_SOURCE_DIR}/include/ hpp)
message("src files:")
foreach(file ${SRCS})
message(STATUS ${file})
endforeach()
message("include directories:")
foreach(dir ${INCLUDES})
message(STATUS ${dir})
endforeach()
add_executable(${PROJECT_N} ${SRCS})
target_include_directories(${PROJECT_N} PUBLIC include)

BIN
hello Executable file

Binary file not shown.

6
src/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main(int argc, char const *argv[])
{
std::cout<< "Hello World!" << std::endl;
return 0;
}