mirror of
https://github.com/libretro/cpp-cheat.git
synced 2025-04-13 00:30:27 +00:00
cmake multi executable example
This commit is contained in:
parent
b7e2282b31
commit
d76e3de59d
@ -119,5 +119,5 @@
|
||||
1. [C++ templates](template_cpp.c)
|
||||
1. [String to int](string_to_int.c)
|
||||
1. [User input](interactive/user_input.c.off)
|
||||
1. [Virtual memory](virtual_memory.c)
|
||||
1. [Memory layout](memory_layout.c)
|
||||
1. [Profiling](interactive/profiling.c)
|
||||
|
@ -30,7 +30,7 @@ int main(int argc, char **argv) {
|
||||
printf(" &heap = %0*" PRIxPTR "\n", PRIxPTR_WIDTH, (uintptr_t)heap);
|
||||
printf(" &bss = %0*" PRIxPTR "\n", PRIxPTR_WIDTH, (uintptr_t)&bss);
|
||||
printf(" &data = %0*" PRIxPTR "\n", PRIxPTR_WIDTH, (uintptr_t)&data);
|
||||
printf(" &str main = %0*" PRIxPTR "\n", PRIxPTR_WIDTH, (uintptr_t)&main);
|
||||
printf(" &main = %0*" PRIxPTR "\n", PRIxPTR_WIDTH, (uintptr_t)&main);
|
||||
printf(" &str char* = %0*" PRIxPTR "\n", PRIxPTR_WIDTH, (uintptr_t)&str);
|
||||
|
||||
free(heap);
|
@ -1,5 +1,8 @@
|
||||
# CMake
|
||||
|
||||
Good examples: <https://github.com/ttroy50/cmake-examples>
|
||||
|
||||
1. [multi_executable](multi_executable/)
|
||||
1. [shared_lib_external](shared_lib_external/)
|
||||
|
||||
Make alternative that aims to be portable.
|
||||
|
7
cmake/multi_executable/CMakeLists.txt
Normal file
7
cmake/multi_executable/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
file(GLOB APP_SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "*.c")
|
||||
message("${APP_SOURCES}")
|
||||
foreach(testsourcefile ${APP_SOURCES})
|
||||
string(REPLACE ".c" "" testname ${testsourcefile})
|
||||
add_executable(${testname} ${testsourcefile})
|
||||
endforeach(testsourcefile ${APP_SOURCES})
|
7
cmake/multi_executable/a.c
Normal file
7
cmake/multi_executable/a.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
puts(__FILE__);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
7
cmake/multi_executable/b.c
Normal file
7
cmake/multi_executable/b.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
puts(__FILE__);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
# sudo apt-get install libgsl-dev
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main gsl gslcblas)
|
||||
|
Loading…
x
Reference in New Issue
Block a user