Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
86a4baba
Commit
86a4baba
authored
Jun 29, 2009
by
Michael Sherman
Browse files
Force CMake to include C++ libraries when building a static C main program.
parent
dee9f78c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
examples/CMakeLists.txt
examples/CMakeLists.txt
+3
-1
examples/Empty.cpp
examples/Empty.cpp
+3
-0
No files found.
examples/CMakeLists.txt
View file @
86a4baba
...
...
@@ -89,7 +89,9 @@ FOREACH(EX_ROOT ${C_EXAMPLES})
IF
(
BUILD_TESTING_STATIC
)
# Link with static library
SET
(
EX_STATIC
${
EX_ROOT
}
Static
)
ADD_EXECUTABLE
(
${
EX_STATIC
}
${
EX_ROOT
}
.c
)
# We need at least one .cpp here to get CMake to include
# C++ libraries on the static link line.
ADD_EXECUTABLE
(
${
EX_STATIC
}
${
EX_ROOT
}
.c Empty.cpp
)
SET_TARGET_PROPERTIES
(
${
EX_STATIC
}
PROPERTIES
COMPILE_FLAGS
"-DOPENMM_USE_STATIC_LIBRARIES"
...
...
examples/Empty.cpp
0 → 100644
View file @
86a4baba
// This empty C++ source file is just used to
// trick CMake into linking with C++ libraries
// when building a C main program statically.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment