Skip to content

Commit 32b009e

Browse files
committed
NLWriter: option NLW2_LIB_ORIG_HDR #30
1 parent 771634b commit 32b009e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

nl-writer2/CMakeLists.txt

+12-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ set(CMAKE_CXX_STANDARD 11)
77
set(CMAKE_CXX_STANDARD_REQUIRED True)
88

99

10+
option(NLW2_LIB_ORIG_HDR
11+
"NLW2_LIB: use original NL header comments" OFF)
12+
13+
1014
set(NLW2_DIR ${CMAKE_CURRENT_SOURCE_DIR})
1115
set(NLW2_LIB_FILES
1216
${NLW2_DIR}/src/nl-writer2.cc
@@ -30,11 +34,12 @@ set(NLW2_LIB_NAME "nlw2")
3034
add_library(${NLW2_LIB_NAME} STATIC
3135
${NLW2_LIB_FILES} ${NLW2_INC_FILES})
3236
target_include_directories(
33-
${NLW2_LIB_NAME} PUBLIC ${NLW2_DIR}/include)
34-
35-
if (MSVC) ## Set the same as for your parent project
36-
## target_compile_options(
37-
## ${NLW2_LIB_NAME} PRIVATE ${AMPL_MSVC_COMPILE_OPTIONS})
37+
${NLW2_LIB_NAME} PUBLIC ${NLW2_DIR}/include)
38+
if (NLW2_LIB_ORIG_HDR)
39+
message(STATUS
40+
" NLW2_LIB: Building with the original NL header comments")
41+
target_compile_definitions(
42+
${NLW2_LIB_NAME} PUBLIC NL_LIB2_ORIG_HDR)
3843
endif()
3944

4045
# NLW2 example
@@ -59,3 +64,5 @@ set(NLW2_INCLUDE_PATH ${NLW2_DIR}/include PARENT_SCOPE)
5964
set(NLW2_SRC
6065
${NLW2_LIB_FILES} ${NLW2_INC_FILES} ${NLSOL_EX_FILES}
6166
PARENT_SCOPE)
67+
# Export library target name
68+
set(NLW2_LIB_NAME ${NLW2_LIB_NAME} PARENT_SCOPE)

0 commit comments

Comments
 (0)