[cmake-commits] alex committed CMakeLists.txt NONE 1.1 bar.c NONE 1.1 foo.c NONE 1.1 main.c NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Jun 26 15:30:04 EDT 2007


Update of /cvsroot/CMake/CMake/Tests/SimpleCOnly
In directory public:/mounts/ram/cvs-serv26938/SimpleCOnly

Added Files:
	CMakeLists.txt bar.c foo.c main.c 
Log Message:

ENH: add a SimpleCOnly test, this is needed e.g. for testing sdcc since this
doesn't support C++ and also doesn't have a printf() implementation by
default
-add a test for mingw cross compiler

Alex


--- NEW FILE: foo.c ---
int foo() { return 12;}

--- NEW FILE: CMakeLists.txt ---
# this enables only C, i.e. disables C++
project(SimpleCOnly C)

add_library(SimpleCLib STATIC bar.c foo.c)

add_executable(SimpleC main.c)
target_link_libraries(SimpleC SimpleCLib)

# and some check, just to make sure it works:
include(CheckTypeSize)
check_type_size(float SIZE_FLOAT)
message(STATUS "sizeof(float): ${SIZE_FLOAT}")

# make sure optimized libs are not used by debug builds
if(CMAKE_BUILD_TYPE MATCHES Debug)
  target_link_libraries(Simple optimized c:/not/here.lib )
endif(CMAKE_BUILD_TYPE MATCHES Debug)

--- NEW FILE: main.c ---
#include <stdio.h>

extern int foo();
extern int bar();

int main() 
{
   int i=foo();
   int k=bar();
   i=i*k;
   return i;
}

--- NEW FILE: bar.c ---
int bar() {return 5;}



More information about the Cmake-commits mailing list