Created
September 24, 2016 05:58
-
-
Save sailfish009/833cd12b078baa8e9eca905e439af7fa to your computer and use it in GitHub Desktop.
cmake app and library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.6) | |
add_subdirectory(a) | |
add_subdirectory(b) | |
SET(CMAKE_DEFAULT_STARTUP_PROJECT b) | |
add_dependencies(b a) | |
-------------------------------------------------- | |
cmake_minimum_required(VERSION 3.6) | |
project(a) | |
set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "" FORCE) | |
set (CMAKE_CXX_STANDARD 11) | |
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} external_windows_system.lib") | |
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../lib) | |
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../lib) | |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../bin) | |
set(CMAKE_CXX_FLAGS_DEBUG | |
"/DWIN32 /D_WINDOWS /MTd /EHsc /WX /wd4355 /wd4251 /wd4250 /wd4996" | |
CACHE STRING "Debug compiler flags" FORCE | |
) | |
set(include_src1 | |
include/aa.h | |
include/bb.h | |
include/cc.h | |
targetver.h | |
stdafx.h | |
) | |
set(include_src2 | |
include/dd.h | |
include/ee.h | |
include/ff.h | |
targetver.h | |
stdafx.h | |
) | |
include_directories(${include_src1} ${include_src2}) | |
set(SOURCE_FILES ${src1} ${include_src1} ${src2} ${include_src2}) | |
add_library(a STATIC ${SOURCE_FILES}) | |
source_group("dir1" FILES ${src1}) | |
source_group("dir2" FILES ${include_src1}) | |
source_group("dir3" FILES ${src2}) | |
source_group("dir4" FILES ${include_src2}) | |
-------------------------------------------------- | |
cmake_minimum_required(VERSION 3.6) | |
project(b) | |
set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "" FORCE) | |
set (CMAKE_CXX_STANDARD 11) | |
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} external_windows_system.lib") | |
include_directories(include) | |
include_directories("../include") | |
link_directories("../lib") | |
set(files | |
stdafx.h | |
targetver.h | |
aa.h | |
aa.cpp | |
bb.cpp | |
cc.cpp | |
dd.cpp | |
stdafx.cpp | |
ee.cpp | |
bb.h | |
cc.h | |
resource.h | |
b.rc | |
) | |
# add_definitions(-D_AFXDLL) | |
add_definitions(-D_AFXSTATIC -D_UNICODE) | |
set(CMAKE_MFC_FLAG 1) | |
add_executable(b WIN32 ${files}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment