Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
exple-cmake-build
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vladimir Onoprienko
exple-cmake-build
Commits
7f8d6ae2
Commit
7f8d6ae2
authored
2 years ago
by
vonopr
Browse files
Options
Downloads
Patches
Plain Diff
Add CMakeLists.txt
parent
5d7cbd9d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMakeLists.txt
+95
-0
95 additions, 0 deletions
CMakeLists.txt
with
95 additions
and
0 deletions
CMakeLists.txt
0 → 100644
+
95
−
0
View file @
7f8d6ae2
cmake_minimum_required
(
VERSION 3.14
)
project
(
exple_cmake_build CXX
)
option
(
DOWNLOAD_DEPS ON
)
# download dependency 'explelibx_common' or find it locally
if
(
DOWNLOAD_DEPS
)
include
(
FetchContent
)
FetchContent_Declare
(
explelibx_common
GIT_REPOSITORY http://tesla.parallel.ru/vonopr/explelibx-common.git
GIT_TAG e45b60782a6414125c7300d9b7a77d34a8404d6e
)
FetchContent_MakeAvailable
(
explelibx_common
)
set
(
COMMON_DIR
"
${
explelibx_common_SOURCE_DIR
}
"
)
else
()
if
(
NOT DEFINED COMMON_DIR
)
file
(
REAL_PATH
"
${
PROJECT_SOURCE_DIR
}
/../../explelibx-common"
COMMON_DIR
)
endif
()
if
(
NOT EXISTS
${
COMMON_DIR
}
)
message
(
WARNING
"Failed to locate 'explelibx-common' project. Variable COMMON_DIR points to non-existent directory.\
Set COMMON_DIR to point a valid directory or enable dependencies download with '-DDOWNLOAD_DEPS=ON' (e.g. cmake . -DDOWNLOAD_DEPS=ON)"
)
endif
()
message
(
"-- Path to 'explelibx-common' project"
)
message
(
" COMMON_DIR:
${
COMMON_DIR
}
"
)
endif
()
# download dependency 'explelibx_mgrid' or find it locally
if
(
DOWNLOAD_DEPS
)
include
(
FetchContent
)
FetchContent_Declare
(
explelibx_mgrid
GIT_REPOSITORY http://tesla.parallel.ru/vonopr/explelibx-mgrid.git
GIT_TAG c345859b9ebca2227e3b3faea4cc2380fdbb054f
)
FetchContent_MakeAvailable
(
explelibx_mgrid
)
set
(
GRID_DIR
"
${
explelibx_mgrid_SOURCE_DIR
}
"
)
else
()
if
(
NOT DEFINED GRID_DIR
)
file
(
REAL_PATH
"
${
PROJECT_SOURCE_DIR
}
/../../explelibx-mgrid"
GRID_DIR
)
endif
()
if
(
NOT EXISTS
${
GRID_DIR
}
)
message
(
WARNING
"Failed to locate 'explelibx-mgrid' project. Variable GRID_DIR points to non-existent directory.\
Set GRID_DIR to point a valid directory or enable dependencies download with '-DDOWNLOAD_DEPS=ON' (e.g. cmake . -DDOWNLOAD_DEPS=ON)"
)
endif
()
message
(
"-- Path to 'explelibx-mgrid' project"
)
message
(
" GRID_DIR:
${
GRID_DIR
}
"
)
endif
()
# set paths to 'explelibx-common' sources
set
(
COMMON_SOURCE_DIR
"
${
COMMON_DIR
}
/explelibx-common"
)
set
(
COMMON_HEADER_DIR
"
${
COMMON_DIR
}
/explelibx-common"
)
set
(
COMMON_SOURCES exple-add.cpp
)
set
(
COMMON_HEADERS exple-add.h
)
list
(
TRANSFORM COMMON_SOURCES PREPEND
"
${
COMMON_SOURCE_DIR
}
/"
)
list
(
TRANSFORM COMMON_HEADERS PREPEND
"
${
COMMON_HEADER_DIR
}
/"
)
# set paths to 'explelibx-mgrid' sources
set
(
GRID_SOURCE_DIR
"
${
GRID_DIR
}
/explelibx-mgrid"
)
set
(
GRID_HEADER_DIR
"
${
GRID_DIR
}
/explelibx-mgrid"
)
set
(
GRID_SOURCES exple-mul.cpp
)
set
(
GRID_HEADERS exple-mul.h
)
list
(
TRANSFORM GRID_SOURCES PREPEND
"
${
GRID_SOURCE_DIR
}
/"
)
list
(
TRANSFORM GRID_HEADERS PREPEND
"
${
GRID_HEADER_DIR
}
/"
)
# set paths to current project's sources
set
(
SOURCE_DIR
"
${
PROJECT_SOURCE_DIR
}
/exple-cmake-build"
)
set
(
HEADER_DIR
"
${
PROJECT_SOURCE_DIR
}
/exple-cmake-build"
)
set
(
CURRENT_SOURCES main.cpp
)
set
(
CURRENT_HEADERS exple-expr.hpp
)
list
(
TRANSFORM CURRENT_SOURCES PREPEND
"
${
SOURCE_DIR
}
/"
)
list
(
TRANSFORM CURRENT_HEADERS PREPEND
"
${
HEADER_DIR
}
/"
)
# set targets
add_executable
(
exple_add_numbers
"
${
CURRENT_SOURCES
}
"
"
${
CURRENT_HEADERS
}
"
"
${
COMMON_SOURCES
}
"
"
${
COMMON_HEADERS
}
"
"
${
GRID_SOURCES
}
"
"
${
GRID_HEADERS
}
"
)
# headers should be explicitly added to the target to be shown in IDEs after mentioned in source_group()
# if using Visual Studio switch to project's target representation
set_property
(
TARGET exple_add_numbers PROPERTY OUTPUT_NAME
"exple-add-numbers"
)
target_include_directories
(
exple_add_numbers PRIVATE
"
${
HEADER_DIR
}
"
"
${
COMMON_HEADER_DIR
}
"
"
${
GRID_HEADER_DIR
}
"
)
# set groups for better source representation in IDEs
source_group
(
"Common
\\
Sources"
FILES
"
${
COMMON_SOURCES
}
"
)
source_group
(
"Common
\\
Headers"
FILES
"
${
COMMON_HEADERS
}
"
)
source_group
(
"Grid
\\
Sources"
FILES
"
${
GRID_SOURCES
}
"
)
source_group
(
"Grid
\\
Headers"
FILES
"
${
GRID_HEADERS
}
"
)
source_group
(
"CMake-Build
\\
Sources"
FILES
"
${
CURRENT_SOURCES
}
"
)
source_group
(
"CMake-Build
\\
Headers"
FILES
"
${
CURRENT_HEADERS
}
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment