cmake 代码

This commit is contained in:
luzhisheng 2024-03-15 13:42:49 +08:00
parent f582268746
commit 52ba10e568
8 changed files with 154 additions and 8 deletions

View File

@ -1,3 +1,134 @@
## cmake
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
## SRC
#set(SRC add.cpp div.cpp mult.cpp main.cpp sub.cpp)
##
#set(EXECUTABLE_OUTPUT_PATH E:/code/js_reverse/CMake构建/v1/bulid/aa/bb/cc)
## C++
#set(CMAKE_CXX_STANDARD 11)
## ${SRC}exe
#add_executable(app ${SRC})
## cmake
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
## SRC PROJECT_SOURCE_DIR cmake .. ..
#aux_source_directory(${PROJECT_SOURCE_DIR} SRC)
## C++
#set(CMAKE_CXX_STANDARD 11)
## ${SRC}exe
#add_executable(app ${SRC})
## cmake
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
## SRC CMAKE_CURRENT_BINARY_DIR CMakeLists.txt
#file(GLOB SRC ${CMAKE_CURRENT_BINARY_DIR}/*.cpp)
## C++
#set(CMAKE_CXX_STANDARD 11)
## ${SRC}exe
#add_executable(app ${SRC})
## cmake
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
## SRC CMAKE_CURRENT_BINARY_DIR CMakeLists.txt
#aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
##
#include_directories(${PROJECT_SOURCE_DIR}/include)
## C++
#set(CMAKE_CXX_STANDARD 11)
## ${SRC}exe
#add_executable(app ${SRC})
# cmake
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
## SRC CMAKE_CURRENT_BINARY_DIR CMakeLists.txt
#aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
##
#include_directories(${PROJECT_SOURCE_DIR}/include)
## C++
#set(CMAKE_CXX_STANDARD 11)
##
#set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib2)
##
#add_library(library SHARED ${SRC})
##
##add_library(library STATIC ${SRC})
# cmake
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
## SRC CMAKE_CURRENT_BINARY_DIR CMakeLists.txt
#file(GLOB SRC ${PROJECT_SOURCE_DIR}/main.cpp)
##
#include_directories(${PROJECT_SOURCE_DIR}/include)
## C++
#set(CMAKE_CXX_STANDARD 11)
#
#link_libraries(library)
#link_directories(${PROJECT_SOURCE_DIR}/lib1/Debug)
#add_executable(app ${SRC})
## cmake
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
## SRC CMAKE_CURRENT_BINARY_DIR CMakeLists.txt
#file(GLOB SRC ${PROJECT_SOURCE_DIR}/main.cpp)
##
#include_directories(${PROJECT_SOURCE_DIR}/include)
## C++
#set(CMAKE_CXX_STANDARD 11)
#
##
#link_directories(${PROJECT_SOURCE_DIR}/lib1/Debug)
#message(STATUS "111111111111111")
#add_executable(app ${SRC})
## FATAL_ERROR
##message(FATAL_ERROR "2222222222222222")
##
#target_link_libraries(app PUBLIC library)
## STATUS
#message(STATUS "55555555555555")
#cmake_minimum_required(VERSION 3.2)
##
#project(test)
#
#file(GLOB SRC ${PROJECT_SOURCE_DIR}/main.cpp)
#include_directories(${PROJECT_SOURCE_DIR}/include)
#set(CMAKE_CXX_STANDARD 11)
#
#set(aaa 1)
#message(${aaa})
##
#set(bbb ${aaa} 2)
#message(${bbb})
##
#list(APPEND bbb 3)
#message(${bbb})
##
#list(REMOVE_ITEM bbb 1)
#message(${bbb})
cmake_minimum_required(VERSION 3.2)
project(test)
add_executable(app add.cpp div.cpp mult.cpp main.cpp sub.cpp)
file(GLOB SRC ${PROJECT_SOURCE_DIR}/h.cpp)
# DEBUG
add_definitions(-DDEBUG)
add_executable(app ${SRC})

15
CMake构建/v1/h.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
#define NUMBER 3
int main()
{
int a = 10;
#ifdef DEBUG
printf("111111111111\n");
#endif
for(int i=0; i<NUMBER; ++i)
{
printf("hello, GCC|||\n");
}
return 0;
}

View File

@ -1,8 +1,7 @@
#include <stdio.h>
#include "head.h"
int main()
{
int main() {
int a = 20;
int b = 12;
printf("a = %d, b = %d\n", a, b);

View File

@ -1,9 +1,10 @@
#include <stdio.h>
#include "head.h"
#include "../include/head.h"
const char* libVersion = "Library Version 1.0";
int add(int a, int b)
{
return a+b;
auto number = 14;
return a+b+number;
}

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include "head.h"
#include "../include/head.h"
double divide(int a, int b)
{

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include "head.h"
#include "../include/head.h"
int multiply(int a, int b)
{

View File

@ -1,5 +1,5 @@
#include <stdio.h>
#include "head.h"
#include "../include/head.h"
int subtract(int a, int b)
{