Adapting the CMake and test for Visual Studio under Windows

This commit is contained in:
Sébastien Rombauts 2013-08-25 20:06:03 +02:00
parent 66ac428732
commit 66ea7c7fa5
4 changed files with 231 additions and 212 deletions

4
.gitignore vendored
View File

@ -6,8 +6,12 @@ build
*.suo
*.user
*sdf
*.vc*
*~
doc
core
*ipch
.settings/
CMakeCache.txt
*.cmake

View File

@ -1,16 +1,28 @@
cmake_minimum_required (VERSION 2.6)
project (SQLiteCpp)
if(MSVC)
include_directories ("${PROJECT_SOURCE_DIR}/sqlite3")
add_library (sqlite3 sqlite3/sqlite3.c sqlite3/sqlite3.h)
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-rdynamic -fstack-protector-all -Wall -Wextra -pedantic -Weffc++ -Wformat-security -Winit-self -Wswitch-default -Wswitch-enum -Wfloat-equal -Wundef -Wshadow -Wcast-qual -Wconversion -Wlogical-op -Winline -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn)
endif()
# add the wrapper as a library
add_library(SQLiteCpp
src/SQLiteC++.h
src/Column.cpp
src/Column.h
src/Database.cpp
src/Database.h
src/Exception.h
src/Statement.cpp
src/Statement.h
src/Transaction.cpp
src/Transaction.h
)
# add the exmple1 executable, linked with the wrapper library
# add the exemple1 executable, linked with the wrapper library
add_executable(example1 examples/example1/main.cpp)
target_link_libraries (example1 SQLiteCpp sqlite3)

View File

@ -89,6 +89,9 @@ Solutions for Visual Studio 2008 and 2010 are provided in the "msvc/" directory,
#### CMake and test
A CMake configuration file is also provided for better multiplatform support and testing.
Generating the Visual Studio 2010 Solution (similar for any other VS up to 2013):
cmake . -G "Visual Studio 10"
Generating the Linux Makefile, building in Debug and executing the tests:
mkdir Debug
cd Debug